Skip to content

Instantly share code, notes, and snippets.

@marcelovani
Forked from fvosberg/php
Created September 25, 2020 09:17
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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