Useful Commands: PHP

Logging Stacktrace

Log up to the last 20 stacktraces for review.

error_log( print_r( debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 20 ), true ) );

Logging Variable

Pretty formatting when logging an object or array variable.

error_log( print_r( $var, true ) );