Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP debug_backtrace() Function

PHP debug_backtrace() Function


PHP Error Reference Manual Complete PHP Error Reference Manual


Definition and Usage

The debug_backtrace() function generates a backtrace.

This function displays the data generated by the debug_backtrace() function code.

Returns an associative array. The following elements may be returned:

Name Type Description
function string The current function name.
line integer The current line number.
file string The current file name.
class string The current class name.
object object The current object.
type string The current call type. Possible calls:
  • Returns: "->" - method call
  • Returns: "::" - static method call
  • Returns nothing - function call
  • | | args | array | If in a function, lists the function arguments. If in an included file, lists the included file name. |

    Syntax

    debug_backtrace()


    Example

    The output of the code above is shown below:

    Array

    (

    [0] => Array

    (

    [file] => C:webfoldertest.php

    [line] => 7

    [function] => three

    [args] => Array

    (

    [0] => Cleveland

    [1] => Brown

    )

    )

    [1] => Array

    (

    [file] => C:webfoldertest.php

    [line] => 3

    [function] => two

    [args] => Array

    (

    [0] => Glenn

    [1] => Quagmire

    )

    )

    [2] => Array

    (

    [file] => C:webfoldertest.php

    [line] => 14

    [function] => one

    [args] => Array

    (

    [0] => Peter

    [1] => Griffin

    )

    )

    )


    PHP Error Reference Manual Complete PHP Error Reference Manual