3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { function __construct(protected readonly int $x) { } } class y extends x { function __construct(protected readonly int $x) { parent::__construct($x); } } new y(1); // Fatal error: Uncaught Error: Cannot modify readonly property y::$x class z extends x { function __construct(int $x) { parent::__construct($x); } } new z(1); // OK ?>
Output for git.master_jit, git.master
Fatal error: Uncaught Error: Cannot modify readonly property y::$x in /in/RIZ8k:4 Stack trace: #0 /in/RIZ8k(10): x->__construct(1) #1 /in/RIZ8k(14): y->__construct(1) #2 {main} thrown in /in/RIZ8k on line 4
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
22.48 ms | 864 KiB | 4 Q