This is probably a simple question, and I'm afraid the answer might be "no", but...
Here's a simple piece of code:
function func1() {
$bt = debug_backtrace();
print "Previous function was " . $bt[1]['function'] . "\n";
}
Now... Can this be done without the temporary variable? In another language, I might expect to be able to say:
function func1() {
print "Previous function was " . (debug_backtrace())[1]['function'] . "\n";
}
Alas, in PHP, this results in an error:
PHP Parse error: syntax error, unexpected '[' ...
If it can't be done, it can't be done, and I'll use a temporary variable, but I'd rather not.