While working on one of my PHP
project I got a function debug_backtrace()
at the start of code file as <?php debug_backtrace() || die ("Direct access not permitted"); ?>
.
While studding on it I got some explanation that it works as:
Debugging PHP issues in a Drupal website can be anything from quick and easy to seriously problematic. PHP includes a debugging function called debug_backtrace , which will print out the chain of code that leads up to the point where the backtrace function is called.
And When I use var_dump()
with debug_backtrace()
I got following result:
array(2) {
[0]=>
array(3) {
["file"]=>
string(61) "C:\xampp\htdocs\folder_name\templates\default\models\home.php"
["line"]=>
int(30)
["function"]=>
string(7) "include"
}
[1]=>
array(4) {
["file"]=>
string(37) "C:\xampp\htdocs\folder_name\index.php"
["line"]=>
int(146)
["args"]=>
array(1) {
[0]=>
string(61) "C:\xampp\htdocs\folder_name\templates\default\models\home.php"
}
["function"]=>
string(7) "include"
}
}
I didn't get that what debug_backtrace()
function exactly work.
Please anyone explain is welcome. Thanks in advance.
Studied links:
debug_backtrace() from registered shutdown function in PHP
Debugging PHP Code with debug_backtrace