PHP : Debugging
Turn On Error Reporting
Only turn this on in dev enviroment.
Turn on globally in php.ini file:
display_errors = On
error_reporting = E_ALL
Turn on for single page:
ini_set('display_errors', 'On');
error_reporting(E_ALL);
Check Variables
echo $variable; // variable value
print_r($array); // print readable array
echo gettype($variable); // variable type
var_dump($variable); // variable type and value
<pre><?=print_r(get_defined_vars())?></pre> // array of defined variables
debug_backtrace(); // show backtrace