<?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);
You have javascript disabled. You will not be able to edit any code.