PHP Manual Backtrace
@shakedko
IF AN EXPERT SAYS IT CAN'T BE DONE GET ANOTHER EXPERT.
- DAVID BEN-GURION

PHP Manual Backtrace

Manually backtrace code in PHP instead of searching the entire stack trace.

class A {
    public function test() {
        $trace = [];
        for ($i = 1; $i <= 3; $i++) {
            $trace[] = debug_backtrace()[$i]['class'] . ':' . debug_backtrace()[$i]['function'] . ':' . debug_backtrace()[$i]['line'] . PHP_EOL;
        }

        print_r($trace);
    }
}

class B {
    public function run() {
        (new A())->test();
    }
}
PHP at (@) sign small note
PHP Manual Backtrace