The method name of the __method__ class (PHP 5.0.0 new addition). Returns the name of the method when it is defined (case-sensitive).
__function__ function name (PHP 4.3.0 new addition). From PHP 5 This constant returns the name (case-sensitive) when the function is defined. In PHP 4, this value is always in lowercase letters.
The document interpretation is the name of the return function (method). The difference is:
__FUNCTION__ is just the name of the return method;
__METHOD__ returns the name of the class and the name of the method.
1<?PHP2 classtest{3 Public functiondoit () {4 Echo __function__;5 }6 Public functionDoitagain () {7 Echo __method__;8 }9 }Ten $obj=NewTest (); One $obj-doit (); A Echo' <br> '; - $obj-Doitagain (); -?>
The output is:
Doit
Test::d Oitagain
The difference between PHP magic variable __method__,__function__