3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface StreamInterfaceA { public function write($data); } interface StreamInterfaceB { public function write($data); } class Stream implements StreamInterfaceA { public function write($data) { echo $data; } } function outputStreamInterfaceB(StreamInterfaceB $stream) { $stream->write('hello world'); } $stream = new Stream(); outputStreamInterfaceB($stream);
based on 5TRJ2
Output for 7.0.0 - 7.2.11
Fatal error: Uncaught TypeError: Argument 1 passed to outputStreamInterfaceB() must implement interface StreamInterfaceB, instance of Stream given, called in /in/EFG1e on line 30 and defined in /in/EFG1e:24 Stack trace: #0 /in/EFG1e(30): outputStreamInterfaceB(Object(Stream)) #1 {main} thrown in /in/EFG1e on line 24
Process exited with code 255.
Output for hhvm-3.21.3 - 3.22.0
Fatal error: Uncaught TypeError: Argument 1 passed to outputStreamInterfaceB() must implement interface StreamInterfaceB, Stream given in /in/EFG1e:-1 Stack trace: #0 /in/EFG1e(-1): outputStreamInterfaceB() #1 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.21.0
Fatal error: Uncaught TypeError: Argument 1 passed to outputStreamInterfaceB() must implement interface StreamInterfaceB, Stream given in /in/EFG1e:26 Stack trace: #0 /in/EFG1e(30): outputStreamInterfaceB() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Catchable fatal error: Argument 1 passed to outputStreamInterfaceB() must implement interface StreamInterfaceB, Stream given in /in/EFG1e on line 26
Process exited with code 255.
Output for 5.3.20 - 5.6.38
Catchable fatal error: Argument 1 passed to outputStreamInterfaceB() must implement interface StreamInterfaceB, instance of Stream given, called in /in/EFG1e on line 30 and defined in /in/EFG1e on line 24
Process exited with code 255.