3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Example { private int $_nextNumber; public int $nextNumber { get { $this->_nextNumber ??= 0; return $this->_nextNumber++; } } } $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/cAfAI:16 Stack trace: #0 {main} thrown in /in/cAfAI on line 16
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:
147.85 ms | 1399 KiB | 8 Q