Retrieving the name of the current function in PHP
PhpFunctionPhp Problem Overview
Is there a function that can return the name of the current function a program is executing?
Php Solutions
Solution 1 - Php
Yes, you can get the function's name with the magic constant __FUNCTION__
class foo
{
function print_func()
{
echo __FUNCTION__;
}
function print_method()
{
echo __METHOD__;
}
}
$obj = new foo();
$obj->print_func(); // Returns: print_func
$obj->print_method(); // Returns: foo::print_method
Solution 2 - Php
Maybe via debug_backtrace http://www.php.net/manual/en/function.debug-backtrace.php