I want to use register_tick_function()to connect the following calls and print a stack trace with debug_backtrace().
If I run the following code.
<?php
function dump() {
foreach (debug_backtrace() as $trace)
echo("Function ${trace['function']}() has been called" . PHP_EOL);
}
declare(ticks = 1);
register_tick_function('dump');
print("");
array_search('green', Array());
It prints only a function dump().
Function dump() has been called
Function dump() has been called
Function dump() has been called
Why can't I see the trace data print()and array_search()? He, like the stack, was reset before the call dump(). I am also sure that it worked correctly in the past.
source
share