Tutorial by Examples

__FUNCTION__ returns only the name of the function whereas __METHOD__ returns the name of the class along with the name of the function: <?php class trick { public function doit() { echo __FUNCTION__; } public function doitagain() { echo __METHOD_...
__CLASS__ magic constant returns the same result as get_class() function called without parameters and they both return the name of the class where it was defined (i.e. where you wrote the function call/constant name ). In contrast, get_class($this) and get_called_class() functions call, will both ...
Current file You can get the name of the current PHP file (with the absolute path) using the __FILE__ magic constant. This is most often used as a logging/debugging technique. echo "We are in the file:" , __FILE__ , "\n"; Current directory To get the absolute path to the di...

Page 1 of 1