3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Example { public int $nextNumber { get { $this->nextNumber ??= 0; return $this->nextNumber++; } set => throw new Error('Property Example::$nextNumber is read-only'); } } $foo = new Example; var_dump($foo->nextNumber, $foo->nextNumber, $foo->nextNumber); $foo->nextNumber = 42;
Output for rfc.property-hooks
int(0) int(1) int(2) Fatal error: Uncaught Error: Property Example::$nextNumber is read-only in /in/t7qhR:9 Stack trace: #0 /in/t7qhR(16): Example->$nextNumber::set(42) #1 {main} thrown in /in/t7qhR on line 9
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:
136.91 ms | 1399 KiB | 8 Q