3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { public readonly Y $y; public function __construct() { $this->y = new Y(); } } class Y {} $x = new X(); unset($x->y); var_dump($x->y);
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught Error: Cannot unset readonly property X::$y in /in/JZIsJ:14 Stack trace: #0 {main} thrown in /in/JZIsJ on line 14
Process exited with code 255.

preferences:
59.75 ms | 857 KiB | 4 Q