3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param mixed[] $a */ function test(array $a): void { if (isset($a['a']['b'])) { echo 'OK'; } } class Foo { } test(['a' => new Foo()]);
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.24, 8.3.0 - 8.3.12
Fatal error: Uncaught Error: Cannot use object of type Foo as array in /in/RegCt:8 Stack trace: #0 /in/RegCt(18): test(Array) #1 {main} thrown in /in/RegCt on line 8
Process exited with code 255.

preferences:
70.76 ms | 406 KiB | 5 Q