PHP debug_print_backtrace() Function

PHP error_get_last() Function
PHP debug_backtrace() Function

In this article, you will learn how to print PHP backtrace. The debug_print_backtrace() function in PHP prints a PHP backtrace.

This function displays data from the code that led up to the debug_print_backtrace() function.

what is the syntax of the DEBUG_PRINT_BACKTRACE() function in php?

debug_print_backtrace(options, limit);
ParameterDescription
optionsOptional. Specifies a bitmask for the following option: DEBUG_BACKTRACE_IGNORE_ARGS (Whether or not to omit the “args” index, and all the function/method arguments, to save memory)
limitOptional. Limits the number of stack frames printed. By default (limit=0) it prints all stack frames
PHP debug_print_backtrace() method

examples of the DEBUG_PRINT_BACKTRACE() function

Example 1. In this example, we print a PHP backtrace.

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

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top