Name and parameters of the parent function

I am trying to figure out how to get the name and parameters of a parent function.

Example:

function foo($a,$b){ bar(); } function bar(){ // Magic Print } foo('hello', 'world'); 

Conclusion:

 foo('hello','world') 

Any tips?

+4
source share
1 answer

You can get information from debug_backtrace () .

 function bar(){ $backtrace = debug_backtrace(); $t = $backtrace[1]; print $t["function"] . "('" . implode("','", $t["args"]) . "')\n"; } 
+5
source

Source: https://habr.com/ru/post/1309433/


All Articles