Page 1 of 1

Get called-from informaiton

Posted: Mon Aug 21, 2006 12:43 pm
by infolock
Is there a way to get information on a file and line # where a call to a specific function was made?

In other words, say I have the function Foo() in class Bar. In the file test.php, it calls Bar::Foo() on line 15. I want to be able to, in the function Foo(), say "Ok, I was called from test.php on line 15".

Just wondering. I know I can pass this information to the function, just wondering if there was a quicker and more efficient method.

Posted: Mon Aug 21, 2006 12:44 pm
by feyd
debug_backtrace() has all the details of the call stack. :)

Posted: Mon Aug 21, 2006 12:46 pm
by infolock
very nice. i forgot all about that one =) thanks.