note 34843 added to function.debug-backtrace
| From: | bernyregeling at rack1 dot php dot net | Date: | Fri, 08 Aug 2003 09:29:01 +0000 |
| Subject: | note 34843 added to function.debug-backtrace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53635@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 $p)
{
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;
----
Manual Page -- http://www.php.net/manual/en/function.debug-backtrace.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34843
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34843&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34843&report=yes