Created
October 10, 2013 06:32
-
-
Save adamsilverstein/6913975 to your computer and use it in GitHub Desktop.
This function will print a stack telling you where it was called from. See http://stackoverflow.com/questions/708140/php-fatal-error-cannot-redeclare-class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function PrintTrace() { | |
$trace = debug_backtrace(); | |
echo '<pre>'; | |
$sb = array(); | |
foreach($trace as $item) { | |
if(isset($item['file'])) { | |
$sb[] = htmlspecialchars("$item[file]:$item[line]"); | |
} else { | |
$sb[] = htmlspecialchars("$item[class]:$item[function]"); | |
} | |
} | |
echo implode("\n",$sb); | |
echo '</pre>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment