Wednesday, April 19, 2017

Quick way to get a backtrace in PHP

Thanks to my friend Karel Lacaci, he send me this useful code.

// DEBUG BACKTRACE START ----------------------------
$file_paths = debug_backtrace();
foreach($file_paths AS $file_path) {
echo $file_path['file'] ;
echo 'Line: ' . $file_path['line'] ;
echo 'Function: ' . $file_path['function'] ;
echo 'Class: ' . $file_path['class'] ;
}
// DEBUG BACKTRACE END ---------------------------- 

No comments:

Post a Comment