note 50713 deleted from function.debug-print-backtrace by aidan

From: Date: Tue, 15 Mar 2005 09:46:02 +0000
Subject: note 50713 deleted from function.debug-print-backtrace by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-86455@lists.php.net to get a copy of this message
Note Submitter: Justin at www.mpsunlimited.com ---- That one gives an error if there are no args, here is one that will not: (this one returns the string instead of echoing it) if (!function_exists('debug_print_backtrace')) { function debug_print_backtrace() { if (isset($_SERVER['REQUEST_URI'])) { $eol = '<br />' . "\n"; } else { $eol = "\n"; } $arr = debug_backtrace(); $dum = array_shift($arr); $ret = ''; for ($i=0; $i < count($arr); $i++) { $v = $arr[$i]; $fileLoc = $v['file'] . ':' . $v['line']; $function = (isset($v['class'])) ? $v['class'] . '.' . $v['function'] : $v['function']; $params = ""; if (isset($v['args'])) { for ($j=0; $j < count($v['args']); $j++) { $p = $v['args'][$j]; $params .= ($params) ? ",$p" : $p; } } $ret .= "#$i. $function($params) called at [$fileLoc]$eol"; } return $ret; } }

« previous php.notes (#86455) next »