<?php readonly class A implements IteratorAggregate { function __construct(public string $foo = 'bar') {} function getIterator() : Traversable { return new ArrayIterator($this); } } $obj = new A; $v = &$obj->foo; $v = "baz"; var_dump($obj); // changed a readonly property
You have javascript disabled. You will not be able to edit any code.