PHP 8.5.0 Released!

Voting

: four plus one?
(Example: nine)

The Note You're Voting On

icefragment at gmail dot com
19 years ago
A simple python-like backtrace. Note that I don't recurse into arrays if they are passed as arguments to functions.
function backtrace()
{
 $bt = debug_backtrace();
 
 echo("<br /><br />Backtrace (most recent call last):<br /><br />\n"); 
 for($i = 0; $i <= count($bt) - 1; $i++)
 {
 if(!isset($bt[$i]["file"]))
 echo("[PHP core called function]<br />");
 else
 echo("File: ".$bt[$i]["file"]."<br />");
 
 if(isset($bt[$i]["line"]))
 echo("&nbsp;&nbsp;&nbsp;&nbsp;line ".$bt[$i]["line"]."<br />");
 echo("&nbsp;&nbsp;&nbsp;&nbsp;function called: ".$bt[$i]["function"]);
 
 if($bt[$i]["args"])
 {
 echo("<br />&nbsp;&nbsp;&nbsp;&nbsp;args: ");
 for($j = 0; $j <= count($bt[$i]["args"]) - 1; $j++)
 {
 if(is_array($bt[$i]["args"][$j]))
 {
 print_r($bt[$i]["args"][$j]);
 }
 else
 echo($bt[$i]["args"][$j]); 
 
 if($j != count($bt[$i]["args"]) - 1)
 echo(", ");
 }
 }
 echo("<br /><br />");
 }
}

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /