Possible Duplicate:
Caller function in PHP 5?
I have some objects that extend one another, and calls various helper methods. I am wondering if there is a way to detect which method called another. here's an example:
class Foo {
function whereAmICalled() {
$calling_method = '' //would like to get func_caller here when code is executed
$calling_class = '' //would like to get 'Bar' here when code is executed
}
}
class Bar extends Foo {
function func_caller() {
$this->whereAmIcalled();
}
}
$bar = New Bar();
$bar->func_caller();