3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Foo { public function test(array $x, $y=0); } interface Bar { public function test(array $x, $y); } interface Baz extends Bar, Foo {} class Quux implements Baz { public function test(array $x, $y=0) { echo "works?"; } } $obj = new Quux; $obj->test([]);
based on 2DsVL
Output for 7.0.0 - 7.2.0
Fatal error: Declaration of Bar::test(array $x, $y) must be compatible with Foo::test(array $x, $y = 0) in /in/n3sBl on line 13
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Fatal error: Declaration of Bar::test() must be compatible with Foo::test(array $x, $y = 0) in /in/n3sBl on line 13
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/n3sBl on line 27
Process exited with code 255.