3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php interface Dynamic { function __call($name, $arguments); } class Foo { public function sing() { var_dump('Do re mi!'); } public function dance() { var_dump('Cha cha cha!'); } } class Bar implements Dynamic { public function __call($name, $arguments) { // @todo; magic } } function gimmeFoo(Foo $foo) { $foo->sing(); $foo->dance(); } gimmeFoo(new Bar()); // works because Dynamic dodges typechecks
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught TypeError: Argument 1 passed to gimmeFoo() must be an instance of Foo, instance of Bar given, called in /in/MOTfr on line 35 and defined in /in/MOTfr:29 Stack trace: #0 /in/MOTfr(35): gimmeFoo(Object(Bar)) #1 {main} thrown in /in/MOTfr on line 29
Process exited with code 255.
Output for hhvm-3.12.0
Catchable fatal error: Argument 1 passed to gimmeFoo() must be an instance of Foo, Bar given in /in/MOTfr on line 33
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.2.0 - 5.6.28
Catchable fatal error: Argument 1 passed to gimmeFoo() must be an instance of Foo, instance of Bar given, called in /in/MOTfr on line 35 and defined in /in/MOTfr on line 29
Process exited with code 255.
Output for 5.1.1 - 5.1.6
Fatal error: Argument 1 passed to gimmeFoo() must be an instance of Foo, called in /in/MOTfr on line 35 and defined in /in/MOTfr on line 29
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/MOTfr on line 35
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Argument 1 must be an instance of Foo in /in/MOTfr on line 29
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/MOTfr on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/MOTfr on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/MOTfr on line 3
Process exited with code 255.