How do I get the function name inside a function in PHP?

function, php

Solution

The accurate way is to use the `__FUNCTION__` predefined magic constant.

Example:

class Test {
    function MethodA(){
        echo __FUNCTION__;
    }
}

Result: `MethodA`.

Problem

Is it possible? ``` function test() { echo "function name is test"; } ```

Original source