3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Beer { const NAME = 'Beer!'; public static function printed(){ echo 'static Beer:NAME = '. static::NAME . PHP_EOL; } } class Ale extends Beer { const NAME = 'Ale!'; public static function printed(){ forward_static_call(array('parent','printed')); call_user_func(array('parent','printed')); forward_static_call(array(parent::class,'printed')); call_user_func(array(parent::class,'printed')); forward_static_call(array('Beer','printed')); call_user_func(array('Beer','printed')); } } Ale::printed();
based on j7Y3t
Output for 5.5.24 - 7.2.0
static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Beer! static Beer:NAME = Ale! static Beer:NAME = Beer!
Output for 5.4.10 - 5.4.45
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/GjlEk on line 16
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /in/GjlEk on line 16
Process exited with code 255.