Skip to content

Instantly share code, notes, and snippets.

@forsvunnet
Created October 3, 2019 09:11
Show Gist options
  • Save forsvunnet/07dfd873e096be130bb83db03f956e31 to your computer and use it in GitHub Desktop.
Save forsvunnet/07dfd873e096be130bb83db03f956e31 to your computer and use it in GitHub Desktop.
Backtracer - simple debug backtrace without risk of recursion
<?php
if ( ! function_exists( 'backtracer' ) ) {
function backtracer( $die = true ) {
$db = debug_backtrace();
echo '<pre>';
foreach ( $db as $record ) {
echo "{$record['file']}:{$record['line']}\n";
}
echo '</pre>';
if ( $die ) {
die;
}
}
}
backtracer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment