3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { } class Bar { } function F(Foo ...$foos) { var_dump($foos); } $arr = [new Foo(), new Foo(), new Bar()]; F(...$arr);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: F(): Argument #3 must be of type Foo, Bar given, called in /in/usf2l on line 10 and defined in /in/usf2l:5 Stack trace: #0 /in/usf2l(10): F(Object(Foo), Object(Foo), Object(Bar)) #1 {main} thrown in /in/usf2l on line 5
Process exited with code 255.
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 3 passed to F() must be an instance of Foo, instance of Bar given, called in /in/usf2l on line 10 and defined in /in/usf2l:5 Stack trace: #0 /in/usf2l(10): F(Object(Foo), Object(Foo), Object(Bar)) #1 {main} thrown in /in/usf2l on line 5
Process exited with code 255.

preferences:
183.97 ms | 402 KiB | 164 Q