Skip to content

Instantly share code, notes, and snippets.

@fvosberg
Last active September 25, 2020 09:18
Show Gist options
  • Save fvosberg/9739975 to your computer and use it in GitHub Desktop.
Save fvosberg/9739975 to your computer and use it in GitHub Desktop.
A very lightweight php backtrace
<?php
$debug_backtrace = debug_backtrace();
$output = [];
foreach ($debug_backtrace as $debug) {
if (isset($debug['class'])) {
$o = $debug['class'];
}
$o .= '::' . $debug['function'];
if( isset( $debug['file'] ) ){
$o .= ' (' . $debug['file'] . ':' . $debug['line'] . ')';
}
$output[] = $o;
}
var_dump($output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment