In PHP 5.3.6 , I noticed that the following will not work:
class Foo{ public static $class = 'Bar'; } class Bar{ public static function sayHello(){ echo 'Hello World'; } } Foo::$class::sayHello();
Issue unexpected T_PAAMAYIM_NEKUDOTAYIM . However, using a temporary variable leads to the expected:
$class = Foo::$class; $class::sayHello();
Does anyone know if this is by design or an unintended result of how the scope operator is indicated or something else? Any cleaner workarounds than the last, temporary example of a variable?
Dan
source share