Page 1 of 1

how to find what file/object/line is calling a method?

Posted: Fri Sep 04, 2009 9:27 am
by dhinge
Some process is calling a method in a class, and I'm not sure which one it is. Is there a way to find out what exactly is running the method?

Re: how to find what file/object/line is calling a method?

Posted: Fri Sep 04, 2009 9:47 am
by jayshields
You could use __LINE__ and __FILE__.

Re: how to find what file/object/line is calling a method?

Posted: Fri Sep 04, 2009 9:52 am
by Mark Baker
have a look at debug_backtrace()

Re: how to find what file/object/line is calling a method?

Posted: Fri Sep 04, 2009 11:04 am
by Mirge
Mark Baker wrote:have a look at debug_backtrace()
Quite useful! Wasn't aware of this function... even though I'm not the OP, thank you :).