You could use echo
, as you mentioned, but the more common and reusable method of debugging PHP as you progress is the use of error_log()
. You can view its output on the PHP server in the php.log file, commonly found at /tmp/php.log
.
You can watch this file in real-time via the Unix command tail -f /tmp/php.log
.
Further, you can output various forms of data by calling it with print_r()
like error_log(print_r($data, TRUE));
.