search
Homephp教程PHP开发How to learn PHP debug_backtrace()

Debug_backtrace function understanding 1

The function of debug_backtrace function is to generate a backtrace.

The debug_backtrace function returns an associative array.

1. How to understand backtrace;

2. Can associative arrays be understood as a new array that is related to the original array;



debug_backtrace function understanding 2

Parameters of debug_backtrace function


function: the current function name.

1. Whether the current function name is a custom function or a system function;

line: the current line number.

1. Can line be understood as the number of lines where the function is called?

file: the current file name.

1.file can be understood as the file where the current debugging is located

class: the current class name

object: the current object.

type: current call type, possible calls:

Return: "->" - method call

Return: "::" - static method call

Return nothing - function call

1. How to understand the calls of various methods;


If the args[] array is in the function, List function parameters. If in a referenced file, list the referenced file name.




##debug_backtrace function understanding 3

<?php 
function 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 ( [file] => C:\wamp\www\web.php [line] => 89 [function] => three [args] => Array ( [0] => Cleveland [1] => Brown ) ) 
[1] => Array ( [file] => C:\wamp\www\web.php [line] => 86 [function] => two [args] => Array ( [0] => Glenn [1] => Quagmire ) ) 
[2] => Array ( [file] => C:\wamp\www\web.php [line] => 94 [function] => one [args] => Array ( [0] => Peter [1] => Griffin ) ) )

The above is how to learn PHP debug_backtrace(). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)