note 34843 modified in function.debug-backtrace by vincent

From: Date: Sun, 07 Dec 2003 16:28:49 +0000
Subject: note 34843 modified in function.debug-backtrace by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-61594@lists.php.net to get a copy of this message
I wrote this function, in addition to jlim, for a nice NO-HTML output. Thee result has similarities to a Java-error. Hope you like it. (BTW, this function exits the script too, if debug_backtrace is displayed) ------------------------------ function debug_bt() { if(!function_exists('debug_backtrace')) { echo 'function debug_backtrace does not exists'."\r\n"; return; } //echo '<pre>'; echo "\r\n".'----------------'."\r\n"; echo 'Debug backtrace:'."\r\n"; echo '----------------'."\r\n"; foreach(debug_backtrace() as $t) { echo "\t" . '@ '; if(isset($t['file'])) echo basename($t['file']) . ':' . $t['line']; else { // if file was not set, I assumed the functioncall // was from PHP compiled source (ie XML-callbacks). echo '<PHP inner-code>'; } echo ' -- '; if(isset($t['class'])) echo $t['class'] . $t['type']; echo $t['function']; if(isset($t['args']) && sizeof($t['args']) > 0) echo '(...)'; else echo '()'; echo "\r\n"; } //echo '</pre>'; exit; } --was-- I wrote this function, in addition to jlim, for a nice NO-HTML output. Thee result has similarities to a Java-error. Hope you like it. (BTW, this function exits the script too, if debug_backtrace is displayed) ------------------------------ function debug_bt() { if(!function_exists('debug_backtrace')) { echo 'function debug_backtrace does not exists'."\r\n"; return; } //echo '<pre>'; echo "\r\n".'----------------'."\r\n"; echo 'Debug backtrace:'."\r\n"; echo '----------------'."\r\n"; foreach(debug_backtrace() as $t) { echo "\t" . '@ '; if(isset($t['file']) echo basename($t['file']) . ':' . $t['line']; else { // if file was not set, I assumed the functioncall // was from PHP compiled source (ie XML-callbacks). echo '<PHP inner-code>'; } echo ' -- '; if(isset($t['class'])) echo $t['class'] . $t['type']; echo $t['function']; if(isset($t['args']) && sizeof($t['args']) > 0) echo '(...)'; else echo '()'; echo "\r\n"; } //echo '</pre>'; exit; } http://www.php.net/manual/en/function.debug-backtrace.php

« previous php.notes (#61594) next »