Approach 1 would work, but Approach 2 would not - it whould result in a fatal error (Function name must be a string in...)
# Approach 1
$function = self::$function and $function();
# Approach 2
self::$function and self::$function();
Isn't this a bit strange? I hope someone could explain.
Edit: To give some context, here's a whole class:
class Example
{
static $function;
static function method()
{
self::$function();
}
}
function callback() {}
Example::$function = 'callback';
Example::method();
self::$function. There's no variable$function.