Reputation:
I'm using the following as a way of seeing listing the various methods in my developement
print basename(__FILE__) . "::serve_table()"
is there any function that's able to return the name of a class method so I don't have to trpe it each time?
Upvotes: 2
Views: 193
Reputation: 12993
I'm not understanding if you need a way to list all the methods of a class or if you need to retrieve the method name you have just called.
If the former, using reflection:
$class = new ReflectionCLass("classname");
$methods = $class->getMethods();
foreach($methods as $m)
print $m->getName();
Upvotes: 1
Reputation: 546183
You could use the information provided by debug_backtrace
which provides the stack trace in an array.
Upvotes: 2