3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public static function test($bar = null) { var_dump(func_get_args()); } } class Baz extends Foo { public static function test($bar, ...$args) { parent::test(...$args); } } Baz::test(); Baz::test('hello');
based on 9L4k9
Output for 7.1.0 - 7.2.0
Warning: Declaration of Baz::test($bar, ...$args) should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 13 Fatal error: Uncaught ArgumentCountError: Too few arguments to function Baz::test(), 0 passed in /in/ZgVsS on line 15 and exactly 1 expected in /in/ZgVsS:10 Stack trace: #0 /in/ZgVsS(15): Baz::test() #1 {main} thrown in /in/ZgVsS on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of Baz::test($bar, ...$args) should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 13 Warning: Missing argument 1 for Baz::test(), called in /in/ZgVsS on line 15 and defined in /in/ZgVsS on line 10 array(0) { } array(0) { }
Output for 5.6.8 - 5.6.28
Strict Standards: Declaration of Baz::test() should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 13 Warning: Missing argument 1 for Baz::test(), called in /in/ZgVsS on line 15 and defined in /in/ZgVsS on line 10 array(0) { } array(0) { }
Output for 5.4.0 - 5.5.35
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /in/ZgVsS on line 10
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '.', expecting '&' or T_VARIABLE in /in/ZgVsS on line 10
Process exited with code 255.