3v4l.org

run code in 500+ 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 8.3.5
Parse error: syntax error, unexpected token "{", expecting "," or ";" in /in/t7qhR on line 4
Process exited with code 255.

preferences:
51.47 ms | 493 KiB | 3 Q