Possible Duplicate:
Caller function in PHP 5?
I would like to know from where a global function or public method is being called. I guess I could do it by inspecting debug_backtrace but I'd rather use a lighterweight mechanism if one exists. Any suggestions?
For example something like so, if you imagine the get_callee() function and constant existing:
function doSomething() {
if(get_callee() == 'PHP_GLOBAL') { throw new IllegalAccessException(); }
...
}
debug_backtrace()
? There are ways. – Madara Uchiha♦ Jun 24 '12 at 19:45