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('Beer','printed')); call_user_func(array('Beer','printed')); } public static function yeah() { echo 'yeah!'.PHP_EOL; } } Ale::printed(); echo 'ASDASD'. PHP_EOL; $asd = new Ale(); call_user_func($asd, 'yeah');
based on dtH5k
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0beta1
static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Beer! ASDASD Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in /in/C7IQa on line 27
Output for hhvm-3.15.4
static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Beer! ASDASD Warning: call_user_func() expects parameter 1 to be a valid callback, object of class Ale given (no __invoke method found) in /in/C7IQa on line 27