Computer >> Computer tutorials >  >> Programming >> PHP

debug_print_backtrace() function in PHP


The debug_print_backtrace() function in PHP displays a backtrace. It does not return a value.

Syntax

debug_print_backtrace(options, limit)

Parameters

  • options − A bitmask for the below given options

  • DEBUG_BACKTRACE_IGNORE_ARGS: Whether or not to omit the "args" index, and all the function/method arguments, to save memory.
  • limit − Limit the number of stack frames printed.

Return

The debug_print_backtrace() function does not return a value.

Example

The following is an example −

<?php
function Test1() {
   Test2();
}
function Test2() {
   Test3();
}
function Test3() {
   Test4();
}
function Test4() {
   debug_print_backtrace();
}
Test1();
?>

Output

Hi: helloarray(1) {
   [0]=>
   array(4) {
      ["file"]=>
      string(30) "/home/cg/root/4127336/main.php"
      ["line"]=>
      int(7)
      ["function"]=>
      string(7) "display"
      ["args"]=>
      array(1) {
         [0]=>
         string(5)
         "hello"
      }
   }
}