Skip to content

Instantly share code, notes, and snippets.

@jpcaparas
Created December 19, 2018 09:07
Show Gist options
  • Save jpcaparas/97f04cbe7eac9dbf6909b3f96eef5969 to your computer and use it in GitHub Desktop.
Save jpcaparas/97f04cbe7eac9dbf6909b3f96eef5969 to your computer and use it in GitHub Desktop.
PHP call trace
<?php
function calltrace() {
$backtrace = debug_backtrace();
$filetrace = array_column($backtrace, 'file');
$linetrace = array_column($backtrace, 'line');
dump(array_map(function($index) use ($filetrace, $linetrace) {
return $filetrace[$index] . ':' . $linetrace[$index];
}, array_keys($filetrace)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment