I want to print the class calling a function in another class, for instance:
class Function_Class {
function callFunction() {
echo "The calling class is X";
}
}
class Calling_Class {
$functionClass = new Function_Class();
$functionClass->callFunction();
}
I want callFunction() to print the class calling it without having to pass $this or something like that. Is this possible?
Print which class is calling a function
Moderator: General Moderators
Re: Print which class is calling a function
Yes, but you should have a really good reason for it.
So why do you want to do this?
So why do you want to do this?
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Print which class is calling a function
I believe that this technique is known as "tracing." However, this is normally done for debugging, and debugging only.