How to use debug_print_backtrace() to prints a backtrace in PHP

1 Answer

0 votes
// test.php

function fa() {
    fb();
}

function fb() {
    fc();
}

function fc(){
    echo "<pre>";
    debug_print_backtrace();
    echo "</pre>";
}

fa();

// test-file.php

include_once 'test.php';
   
   
/*
run:

#0  fc() called at [C:\xampp\htdocs\knowrex.com\test.php:15]
#1  fb() called at [C:\xampp\htdocs\knowrex.com\test.php:11]
#2  fa() called at [C:\xampp\htdocs\knowrex.com\test.php:24]
#3  include_once(C:\xampp\htdocs\knowrex.com\test.php) called at 
    [C:\xampp\htdocs\knowrex.com\test-file.php:8]

*/

 



answered Jun 14, 2016 by avibootz
...