Η συνάρτηση debug_print_backtrace() του PHP

Παράδειγμα

τυπώνει μια ακολουθία PHP ανατροφοδότησης:

<?php
 function a($txt) {
     b(\"Glenn\");
 }
 function b($txt) {
     c(\"\"Cleveland\"\
}
 function c($txt) {
     debug_print_backtrace();
 }
 a("Peter");
 ?> 

The output of the above code is similar to this:

#0 c(Cleveland) called at [C:\webfolder\test.php:6]
 #1 b(Glenn) called at [C:\webfolder\test.php:3]
 #2 a(Peter) called at [C:\webfolder\test.php:11]

Definition and Usage

debug_print_backtrace() function prints PHP backtrace (backtrace).

debug_print_backtrace() prints a PHP backtrace. It prints function calls, included/required files, and eval() code.

Syntax

debug_print_backtrace(options,limit);
Parameter Description
options

Optional. Specifies the bitmask for the following parameters:

  • DEBUG_BACKTRACE_IGNORE_ARGS (Whether to ignore the index of "args", including all function/method parameters, which can save memory overhead.)
limit Optional. Used to limit the number of stack frames returned. The default is (limit=0), which returns all stack frames.

Technical Details

Return Value: None
PHP Version: 5.0+
PHP Update Log:

PHP 5.4: Added optional parameters limit.

PHP 5.3.6: Added optional parameters options.