3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'string'; $offset = new stdClass(); $v1 = isset($str[$offset]) ? 'true' : 'false'; var_dump($v1); $v2 = $str[$offset] ?? 'false';
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
string(5) "false" Fatal error: Uncaught TypeError: Cannot access offset of type stdClass on string in /in/aDLLB:8 Stack trace: #0 {main} thrown in /in/aDLLB on line 8
Process exited with code 255.

preferences:
53.69 ms | 406 KiB | 5 Q