<?php class Foo { public string $ref { get => $this->_ref; set => $this->_ref = $value; } public function __construct( private string &$_ref, ) {} } $var = 'hello'; $foo = new Foo($var); $foo->ref = 'world'; echo $var;
You have javascript disabled. You will not be able to edit any code.