3v4l.org

run code in 500+ PHP versions simultaneously
<?php class z { public readonly int $p; public readonly int $q; public function __construct() { $this->p = 1; } } $x = new z; // foreach skips undefined properties, readonly or not foreach($x as $k => $v) { print $k . " " . $v . PHP_EOL; } echo $x->q; ?>
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.21, 8.5.0 - 8.5.6
p 1 Fatal error: Uncaught Error: Typed property z::$q must not be accessed before initialization in /in/cAniT:20 Stack trace: #0 {main} thrown in /in/cAniT on line 20
Process exited with code 255.

preferences:
60.69 ms | 863 KiB | 4 Q