Skip to content

Instantly share code, notes, and snippets.

@robcolburn
Last active August 29, 2015 14:08
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 robcolburn/0990835eb8b045bff527 to your computer and use it in GitHub Desktop.
Save robcolburn/0990835eb8b045bff527 to your computer and use it in GitHub Desktop.
<?php
function print_backtrace() {
$x = debug_backtrace();
for ($i = 0, $l = count($x); $i < $l; $i++) {
echo $x[$i]['file'], ':', $x[$i]['line'], "\n";
echo ($l - $i), ': ', $x[$i]['function'], '(';
foreach ($x[$i] ['args'] as $j => $arg) {
echo ($j > 0 ? ', ' : ''),
is_scalar($arg) ? $arg :
((is_array($arg) || is_object($arg)) ? json_encode($arg) :
gettype($arg));
}
echo ")\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment