3v4l.org

run code in 300+ PHP versions simultaneously
<?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');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Declaration of Baz::test($bar, ...$args) must be compatible with Foo::test($bar = null) in /in/ZgVsS on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of Baz::test($bar, ...$args) should be compatible with Foo::test($bar = NULL) in /in/ZgVsS on line 10 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.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
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.32
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.0 - 5.6.38
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.4.45, 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /in/ZgVsS on line 10
Process exited with code 255.

preferences:
235.77 ms | 402 KiB | 369 Q