English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Error & Loggings Reference Manual
The debug_backtrace() function generates a backtrace trace
array debug_backtrace(void);
It 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:
|
args | array | If in a function, list the function parameters. If in the referenced file, list the name of the referenced file. |
Number | Parameters and Description |
---|---|
1 | void No parameters required |
As described in the instructions, it returns an associative array.
Here is the usage of the debug_backtrace() function-
<?php function printStr($str) { echo "Hi: $str"; var_dump(debug_backtrace()); } printStr('hello'); ?>Test to see‹/›
This will produce the following result-
Hi: helloarray(1) { [0]=> array(4) { ["file"]=> string(36) "/var/www/w3codebox/php/test.php" ["line"]=> int(8) ["function"]=> string(8) "printStr" ["args"]=> array(1) { [0]=> &string(6) "hello" } } }