<?php
function a($txt) {
b("Glenn");
}
function b($txt) {
c("Cleveland");
}
function c($txt) {
echo '<pre>', var_dump(debug_backtrace());
}
a("Peter");
?>
array(3) {
[0]=>
array(4) {
["file"]=>
string(21) "/home/Xx8WIO/prog.php"
["line"]=>
int(10)
["function"]=>
string(1) "c"
["args"]=>
array(1) {
[0]=>
string(9) "Cleveland"
}
}
[1]=>
array(4) {
["file"]=>
string(21) "/home/Xx8WIO/prog.php"
["line"]=>
int(7)
["function"]=>
string(1) "b"
["args"]=>
array(1) {
[0]=>
string(5) "Glenn"
}
}
[2]=>
array(4) {
["file"]=>
string(21) "/home/Xx8WIO/prog.php"
["line"]=>
int(15)
["function"]=>
string(1) "a"
["args"]=>
array(1) {
[0]=>
string(5) "Peter"
}
}
}
The debug_backtrace() function generates a PHP backtrace.
This function displays data from the code that led up to the debug_backtrace() function.
Returns an array of associative arrays. The possible returned elements are:
https://www.w3schools.com/php/func_error_debug_backtrace.asp
No comments:
Post a Comment