3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: outputStreamInterfaceB(): Argument #1 ($stream) must be of type StreamInterfaceB, 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 7.0.0 - 7.0.31, 7.1.0 - 7.1.23, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
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 5.5.0 - 5.5.38, 5.6.0 - 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.

preferences:
223.21 ms | 402 KiB | 288 Q