Is it possible to tell where a method was called from?
Posted: Tue Jul 25, 2006 8:14 pm
Say I have one class like this... Is it possible to find out from which class (and method if possible) another class is called from?
I know I could pass the doSomething method a variable with $this in it... is there any way for the method to know AUTOMATICALLY though?
Code: Select all
class someClass{
function someClass(){
$obj = new otherClass();
$obj->doSomething();
}
}
class otherClass{
function doSomething(){
$this->source = //Some way to find out where this was called from
}
}