Possible Duplicate:
Find out which class called a method in another class.
Hello everyone,
I have a class and I can't find where his object creates. I mean, can I somehow find out who calls his constructor?
Thanks a lot, Andrey.
Possible Duplicate:
Find out which class called a method in another class.
Hello everyone,
I have a class and I can't find where his object creates. I mean, can I somehow find out who calls his constructor?
Thanks a lot, Andrey.
You can use debug_backtrace() or even better a tracer/profiler like Xdebug to gather the information and e.g. KCachegrind to visualize it.
use
$trace = debug_backtrace();
echo "<pre>".print_r($trace[1])."</pre>";
//see all the displays '1' is the referrer '0' is self
echo $callingfunction = $trace[1]['function'];
echo $callingclass = $trace[1]['class'];