Hello folks! welcome back to a new section of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP debug_backtrace() Function.
The built-in PHP debug_backtrace() function is used to return an associative array. The possible returned elements are as follows -
The built-in PHP debug_backtrace() function is used to return an associative array. 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 | string | 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. |
arg | array | If inside a function, this lists the functions arguments. If inside an included file, this lists the included file name(s). |
Syntax
Following below is the syntax to use this function -
array debug_backtrace ( void );
READ: PHP | readdir() Function
Parameter Details
Sr.No | Parameter & Description |
---|---|
1 | void NA. |
Return Value
This built-in function returns an associative array.
Example
Try out the below example -
<?php function printStr($str) { echo "Hi: $str"; var_dump(debug_backtrace()); } printStr('hello'); ?>
Output
When the above code is executed, it will produce the following result -
Hi: helloarray(1) { [0]=> array(4) { ["file"]=> string(36) "/var/www/webdesigntutorialz/php/test.php" ["line"]=> int(8) ["function"]=> string(8) "printStr" ["args"]=> array(1) { [0]=> &string(6) "hello" } } }
Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial guide, we are going to be discussing about the PHP debug_print_backtrace() Function.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.