note 35437 added to function.debug-backtrace

From: Date: Mon, 01 Sep 2003 11:18:08 +0000
Subject: note 35437 added to function.debug-backtrace
Groups: php.notes 
Request: Send a blank email to php-notes+get-55398@lists.php.net to get a copy of this message
I coded a function, too. Just call debug() evertime you think you could encounter an error: <? function debug() { $debug_array = debug_backtrace(); $counter = count($debug_array); for($tmp_counter = 0; $tmp_counter != $counter; ++$tmp_counter) { ?> <table width="558" height="116" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000"> <tr> <td height="38" bgcolor="#D6D7FC"><font color="#000000">function <font color="#FF3300"><? echo($debug_array[$tmp_counter]["function"]);?>(</font> <font color="#2020F0"><? //count how many args a there $args_counter = count($debug_array[$tmp_counter]["args"]); //print them for($tmp_args_counter = 0; $tmp_args_counter != $args_counter; ++$tmp_args_counter) { echo($debug_array[$tmp_counter]["args"][$tmp_args_counter]); if(($tmp_args_counter + 1) != $args_counter) { echo(", "); } else { echo(" "); } } ?></font><font color="#FF3300">)</font></font></td> </tr> <tr> <td bgcolor="#5F72FA"><font color="#FFFFFF">{</font><br> <font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file: <? echo($debug_array[$tmp_counter]["file"]);?></font><br> <font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line: <? echo($debug_array[$tmp_counter]["line"]);?></font><br> <font color="#FFFFFF">}</font></td> </tr> </table> <? if(($tmp_counter + 1) != $counter) { echo("<br>was called by:<br>"); } } 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+35437 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35437&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35437&report=yes

« previous php.notes (#55398) next »