I am having a problem with accessing Class methods using variable instead of function name. Like in below example:
class Test
{
public static function route()
{
$functionName = "myFunction";
echo self::$functionName;
}
public static function myFunction()
{
return "Hello";
}
}
I am getting error message:
Fatal error: Access to undeclared static property: Test::$functionName
Is there a way of accessing class methods using variables containing function name? Please help :)
self::$functionName()