Reputation: 9076
In PHP, if method foo() calls method bar($name), can it pass it's method name (i.e. 'foo') as a parameter?
Upvotes: 0
Views: 110
Reputation: 5622
Use magic constant FUNCTION
function foo(){
bar(__FUNCTION__);
}
Additionall use
__METHOD__ to get the name of a method
http://php.net/manual/en/language.constants.predefined.php
Upvotes: 4