Home Tutorial Php Phpbasics Tutorial PHP Debug Backtrace


Share on Google+Share on Google+
PHP Debug Backtrace
Posted on: March 5, 2010 at 12:00 AM
In this tutorial we will study about another interesting feature of PHP, called debug_backtrace() method, this method helps us to generate the backtrace in PHP. You can also check the format of it and examples will help you to learn it precisely.

PHP Debug Backtrace:

Debug Backtrace or debug_backtrace() is used to generate the backtrace in PHP in  associative array format. General format of the function is:

array debug_backtrace (<bool $provide_object = true >)    

Probable list of returned elements from debug_backtrace() are as below:

Name Type Description
Function String Current function name
Line Integer Current line number
File String Current file name
Class String Current file name
Object String Current object name
Type String Current call type, e.g. returns -> for method call, returns :: for static method call, and returns nothing function call
Args Array If inside a function then list of the arguments



function one($var1,$var2){



function two($var1,$var2){







Array ( [0] => Array ( [file] =>../error.php [line] => 3 [function] => two [args] => Array ( [0] => Hello [1] => World ) ) [1] => Array ( [file] => ../error.php [line] => 10 [function] => one [args] => Array ( [0] => rose [1] => india ) ) )

Related Tags for PHP Debug Backtrace:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 5, 2010

Recommend the tutorial

Advertisements Advertisements