Skip to content

Instantly share code, notes, and snippets.

@YavorK
Forked from eddieajau/debug.php
Created August 31, 2016 13:46
Show Gist options
  • Save YavorK/8226a028ea53bea1a97f514a7b77ce86 to your computer and use it in GitHub Desktop.
Save YavorK/8226a028ea53bea1a97f514a7b77ce86 to your computer and use it in GitHub Desktop.
Printing a clean debug backtrace in PHP.
// PHP < 5.3.6
foreach (debug_backtrace() as $trace)
{
echo sprintf("\n%s:%s %s::%s", $trace['file'], $trace['line'], $trace['class'], $trace['function']);
}
die;
// PHP >= 5.3.6
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
die;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment