3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public readonly int $bar; public function __construct(int &$bar) { // Error right here, can't assign reference $this->bar = &$bar; } } $i = 42; $foo = new Foo($i); $i++; var_dump($foo->bar);

preferences:
23.42 ms | 474 KiB | 4 Q