In what scenarios would running a PHP script in the console be beneficial for debugging and testing purposes?

Running a PHP script in the console can be beneficial for debugging and testing purposes when you need to quickly test a specific function or piece of code without having to set up a full web server environment. It can also be helpful for debugging by allowing you to see error messages and output directly in the console.

<?php

// Example PHP script for debugging and testing purposes
function addNumbers($num1, $num2) {
    return $num1 + $num2;
}

// Test the addNumbers function
$result = addNumbers(5, 10);
echo "The result is: " . $result;

?>