Skip to content

Instantly share code, notes, and snippets.

@martinandersen3d
Forked from eddieajau/debug.php
Created May 31, 2018 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinandersen3d/02afef88a86d892947f8e4a3a786568e to your computer and use it in GitHub Desktop.
Save martinandersen3d/02afef88a86d892947f8e4a3a786568e 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