PHP

Getting Started String Date If Else Loop Array Functions Session Files Super Global Variables Debugging MySQL MySQL Read Data JSON Markdown
O O

Weather Controls

Time Of Day
Rain
Wind Speed
Wind Direction
Clouds

PHP : Debugging

2017-11-28

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