3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class ValueObj { } interface A { public function method(ValueObj $a); } class B implements A { public function method($a) { echo 'hello'; } } $b = new B; $v = new ValueObj; $b->method($v);
Output for 7.2.0
hello
Output for 7.0.0 - 7.1.10
Fatal error: Declaration of B::method($a) must be compatible with A::method(ValueObj $a) in /in/Yi3Gk on line 9
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Fatal error: Declaration of B::method() must be compatible with A::method(ValueObj $a) in /in/Yi3Gk on line 9
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Fatal error: Declaration of B::method() must be compatible with that of A::method() in /in/Yi3Gk on line 9
Process exited with code 255.