Why the following
class AClass { public function __construct () { $this->prop = \"Hello\"; } public function &get () {
You should remove the ampersand in your func function. Then it will return you the string.
func
function func (&$ref) { $ref = $ref->get(); }