There are a couple of options that developers have available in debugging PHP scripts:
1. Use ‘echo’ to print out variables (obviously!)
2. Use ‘print_r’ which is also useful, and can print arrays. You can also assign the output of print_r to a variable as a string – $s = print_r($myArray, true);
3. Use ‘debug_backtrace’ or ‘debug_print_backtrace’ which prints the trace back showing file names involved, functions, classes and line numbers.