3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php <?php class BaseClass { private static $queryClass = 'StaticSqlQuery'; public static function setQueryClass($className) { static::$queryClass = $className; } public static function test() { return forward_static_call(static::$queryClass, 'init'); } } class StaticSqlQuery { public static function init($tableName, $className) { return 'Original call'; } } echo BaseClass::test(); BaseClass::setQueryClass( get_class(new class extends StaticSQLQuery { public static function init($tableName, $className) { return 'My stub'; } }) ); echo BaseClass::test();
Output for 7.0.0 - 7.0.1
Parse error: syntax error, unexpected '<', expecting end of file in /in/1rDVk on line 3
Process exited with code 255.
Output for 5.3.21 - 5.6.16
Parse error: syntax error, unexpected '<' in /in/1rDVk on line 3
Process exited with code 255.