Skip to content

Instantly share code, notes, and snippets.

View birawaich's full-sized avatar

birawaich birawaich

View GitHub Profile
@jhurliman
jhurliman / stacktrace.php
Created July 20, 2012 00:03
Pretty print stack trace in PHP
function stackTrace() {
$stack = debug_backtrace();
$output = 'Stack trace:' . PHP_EOL;
$stackLen = count($stack);
for ($i = 1; $i < $stackLen; $i++) {
$entry = $stack[$i];
$func = $entry['function'] . '(';
$argsLen = count($entry['args']);