3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class HelloWorld { public function sayHello(?\stdClass $date): void { $date ??= new \stdClass(); echo isset($date['a']); } } $hw = new HelloWorld(); $hw->sayHello(null);
Output for 7.4.33, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/GVD8v:8 Stack trace: #0 /in/GVD8v(13): HelloWorld->sayHello(Object(stdClass)) #1 {main} thrown in /in/GVD8v on line 8
Process exited with code 255.

preferences:
62.44 ms | 402 KiB | 63 Q