Using __FUNCTION__ is the way instead:
public function something() { $thisMethodName = "something"; }
which is somewhat frightening to add a variable and memory to store the method name as a string and duplicate what already exists, so adding resources to it unnecessarily (if you do this for a large library with many methods, this is of great importance).
The magic constants in PHP are not guaranteed to change, while this approach will require applicable editing if the method name has been changed, thereby presenting a potential for inconsistency (note that I really said that this simply means unnecessary editing if a magic constant was used instead).
Time and effort to name a variable, enter the type of the method as a string assigned to this unnecessary variable, and, of course, correctly referring to the name of the variable, which is the motivation for PHP supplying magic constants to start (and refuting any __FUNCTION__ requirement __FUNCTION__ not required )
Anonymous Visitor Apr 27 '13 at 15:40 2013-04-27 15:40
source share