3v4l.org

run code in 300+ PHP versions simultaneously
<?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

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
151.13 ms | 1356 KiB | 9 Q