Thanks to everyone's quick replies.

I have implemented the debug_backtrace for my solution. Since I only wanted the 'calling' class/method I used the second element of the debug_backtrace array (actually [1]).
Here's what my solution looks like in sample code:
Code: Select all
class Test {
function __construct(){
$this->doSomething();
}
function doSomething(){
$dbt = debug_backtrace();
echo "Here is the name of the object and method that called this method :".$dbt[1]['class']." ".$dbt[1]['function'];
}
}
$test = new Test;
The above outputs the following: Here is the name of the object and method that called this method :Test __construct