3v4l.org

run code in 300+ PHP versions simultaneously
<?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');
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Deprecated: Use of "parent" in callables is deprecated in /in/C7IQa on line 13 static Beer:NAME = Ale! Deprecated: Use of "parent" in callables is deprecated in /in/C7IQa on line 14 static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Beer! ASDASD Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, no array or string given in /in/C7IQa:27 Stack trace: #0 {main} thrown in /in/C7IQa on line 27
Process exited with code 255.
Output for 8.0.10 - 8.0.30, 8.1.0 - 8.1.27
static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Beer! ASDASD Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, no array or string given in /in/C7IQa:27 Stack trace: #0 {main} thrown in /in/C7IQa on line 27
Process exited with code 255.
Output for 8.0.0 - 8.0.9
static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Ale! static Beer:NAME = Beer! ASDASD Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($function) must be a valid callback, no array or string given in /in/C7IQa:27 Stack trace: #0 {main} thrown in /in/C7IQa on line 27
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
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

preferences:
159.53 ms | 402 KiB | 168 Q