PHP debug_backtrace() Function

P
PHP debug_print_backtrace() Function
PHP is_null() Function

In this article, you will learn how to generate a PHP backtrace. The debug_backtrace() function in PHP outputs a PHP backtrace. This function displays data from the code that led up to the debug_backtrace() function.

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

Possible return values of the PHP debug_backtrace() function are:

NameTypeDescription
functionstringThe current function name
lineintegerThe current line number
filestringThe current file name
classstringThe current class name
objectobjectThe current object
typestringThe current call type. Possible calls:Returns: “->”  – Method callReturns: “::”  – Static method callReturns nothing – Function call
argsarrayIf inside a function, it lists the functions arguments. If inside an included file, it lists the included file names
PHP debug_backtrace() method

examples of the DEBUG_BACKTRACE() function

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

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

Add comment

Tutor Network

Share this

Learn PHP from A to Z