3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Papa { public function __construct() { $args = func_get_args(); echo print_r($args, true); } } class Kiddo extends Papa { public function __construct() { $args = func_get_args(); $parent_class = 'parent'; if (version_compare(PHP_VERSION, '5.5.0') >= 0) { $parent_class = parent::class; } call_user_func_array(array($parent_class, '__construct'), $args); } } $x = new Papa('bee'); $y = new Kiddo('hello', 'me');

preferences:
49.15 ms | 405 KiB | 5 Q