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; foreach ($obj as $k => &$v) { $v = 'baz'; } var_dump($obj); // changed a readonly property
Output for git.master_jit, git.master
object(A)#1 (1) { ["foo"]=> &string(3) "baz" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
146.78 ms | 1394 KiB | 9 Q