3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function instantiate() { return new static; } } class Bar extends Foo { public static function getName() { return 'Foo'; } } var_dump( Bar::instantiate() ); var_dump( $foo = new Bar::getName() );
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected 'getName' (T_STRING), expecting variable (T_VARIABLE) or '$' in /in/JeVJA on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /in/JeVJA on line 19
Process exited with code 255.

preferences:
190.35 ms | 1399 KiB | 62 Q