Menu Samaritan's Purse

DEBUG_BACKTRACE

Generates a backtrace

SYNTAX

debug_backtrace ([ int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT [, int $limit = 0 ]] ) : array

PARAMETERS

options

A bitmask for the following options:

DEBUG_BACKTRACE_PROVIDE_OBJECT Whether or not to populate the "object" index.
DEBUG_BACKTRACE_IGNORE_ARGS Whether or not to omit the "args" index, and thus all the function/method arguments, to save memory.
limit

Limit the number of stack frames returned. By default (limit=0) it returns all stack frames.

RETURN

Returns an array of associative arrays. The possible returned elements are as follows:

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. If a method call, "->" is returned. If a static method call, "::" is returned. If a function call, nothing is returned.
args array If inside a function, this lists the functions arguments. If inside an included file, this lists the included file name(s).

EXAMPLES

VOID

Array
(
    [0] => Array
        (
            [file] => /home/user/public_html/file.php
            [line] => 8
            [function] => myfunction2
            [args] => Array
                (
                    [0] => 2
                    [1] => 3
                )

        )

    [1] => Array
        (
            [file] => /home/user/public_html/file.php
            [line] => 20
            [function] => myfunction1
            [args] => Array
                (
                    [0] => 1
                    [1] => 2
                )

        )

)

OPTIONS | DEBUG_BACKTRACE_PROVIDE_OBJECT

Array
(
    [0] => Array
        (
            [file] => /home/user/public_html/file.php
            [line] => 8
            [function] => myfunction2
            [args] => Array
                (
                    [0] => 2
                    [1] => 3
                )

        )

    [1] => Array
        (
            [file] => /home/user/public_html/file.php
            [line] => 22
            [function] => myfunction1
            [args] => Array
                (
                    [0] => 1
                    [1] => 2
                )

        )

)

OPTIONS | DEBUG_BACKTRACE_IGNORE_ARGS

Array
(
    [0] => Array
        (
            [file] => /home/user/public_html/file.php
            [line] => 8
            [function] => myfunction2
        )

    [1] => Array
        (
            [file] => /home/user/public_html/file.php
            [line] => 22
            [function] => myfunction1
        )

)

LIMIT

Array
(
    [0] => Array
        (
            [file] => /home/user/public_html/file.php
            [line] => 8
            [function] => myfunction2
            [args] => Array
                (
                    [0] => 2
                    [1] => 3
                )

        )

)

PHP