How to use debug backtrace in PHP

This article describe about debug_backtrace() function in PHP.
  • 1800

debug_backtrace() function

This function generate a backtrace.

Function display data from the code that led up to the debug_backtrace() function.

It return the associative array.

Name Type Description
function string Function Name
line integer The present line number.
file string The present file name.
class string The present file name.
object object The present object.
type string Possible call
  • Returns: "->" - Method call
  • Returns: "::" - Static method call
  • Returns nothing - Function call
args array list of the function argument.

Syntax

debug_backtrace()

 

Example

 

<html>
<body>
<?php
function one($str1, $str2)
{
two("Glokha", "Quage");
}
function two($str1, $str2)
{
three("Clever", "Gray");
}
function three($str1, $str2)
{
print_r(debug_backtrace());
}

one("Peter", "Griffin");
?>
</body>
</html>

Output

pic15.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.