3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AbstractFoo { protected static $state; public static setState($state) { static:$state = $state; } public static getState() { return static::$state; } } class Foo extends AbstractFoo {} class Bar extends AbstractFoo {} $Foo = new Foo; $bar = new Bar; AbstractFoo::setState('abstract'); var_dump($bar::getState()); $foo::setState('foo'); var_dump($bar::getState());
Output for 5.4.0 - 5.4.20
Parse error: syntax error, unexpected 'setState' (T_STRING), expecting variable (T_VARIABLE) in /in/qIVQG on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/qIVQG on line 6
Process exited with code 255.

preferences:
174.19 ms | 1395 KiB | 56 Q