I am looking over some PHP code and I found some references to the PHP constant __METHOD__. I read the PHP documentation but all it says is
The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).
This isn't clear to me. Can anyone give an example or describe this in more detail?
__METHOD__ returns the name of the current class and method you are in when calling that constant.
http://php.net/manual/en/language.constants.predefined.php
__FUNCTION__ will only return the function name.
echo __METHOD__."in".__FILE__." called";
You can use it for debug or log purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With