Skip to content

Instantly share code, notes, and snippets.

@cfg
Created August 21, 2013 16:50
Show Gist options
  • Select an option

  • Save cfg/6297003 to your computer and use it in GitHub Desktop.

Select an option

Save cfg/6297003 to your computer and use it in GitHub Desktop.
ugly
<?php
function cfg_get_stack() {
$bt = debug_backtrace();
$stack = array();
array_shift($bt);
foreach( $bt as $item ) {
$str = '';
if( isset($item['file']) )
$str .= basename($item['file']);
if( isset($item['line']) )
$str.= ':' . $item['line'];
if( isset($item['function']) )
$str.= ' ' . $item['function'];
if( !empty($str) )
$stack[] = $str;
}
return $stack;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment