PHP debug_backtrace () function

Source: Internet
Author: User
Definition and usage

The PHP debug_backtrace () function generates a backtrace.

This function returns an associated array. The following elements may be returned:

Name Type Description
Function String The current function name.
Line Integer The current row number.
File String The current file name.
Class String Current Class Name
Object Object Current object.
Type String The current call type. Possible calls:

  • Return Value: "->"-method call
  • Return Value: ":"-static method call
  • Return nothing-function call
ARGs Array If function parameters are listed. If the referenced file lists the referenced file names.
Syntax
debug_backtrace()
Example
<?phpfunction one($str1, $str2) { two("Glenn", "Quagmire"); }function two($str1, $str2) { three("Cleveland", "Brown"); }function three($str1, $str2) { print_r(debug_backtrace()); }one("Peter", "Griffin");?>

Output:

Array([0] => Array  (  => C:/webfolder/test.php [line] => 7 [function] => three [args] => Array  (  [0] => Cleveland  [1] => Brown   )  )[1] => Array (  => C:/webfolder/test.php [line] => 3 [function] => two [args] => Array  (  [0] => Glenn  [1] => Quagmire  ) ) [2] => Array (  => C:/webfolder/test.php [line] => 14 [function] => one [args] => Array  (  [0] => Peter  [1] => Griffin  ) ))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.