3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
===ArrayObject=== <?php $a = new ArrayObject(); $a[] = 1; $b = clone $a; var_dump($a[0], $b[0]); $b[0] = $b[0] + 1; var_dump($a[0], $b[0]); $b[0] = 3; var_dump($a[0], $b[0]); ?> ===ArrayIterator=== <?php $a = new ArrayIterator(); $a[] = 1; $b = clone $a; var_dump($a[0], $b[0]); $b[0] = $b[0] + 1; var_dump($a[0], $b[0]); $b[0] = 3; var_dump($a[0], $b[0]); ?>
Output for 5.1.3 - 7.1.0
===ArrayObject=== int(1) int(1) int(1) int(2) int(1) int(3) ===ArrayIterator=== int(1) int(1) int(2) int(2) int(3) int(3)
Output for 5.0.0 - 5.1.2
===ArrayObject=== int(1) int(1) int(2) int(2) int(3) int(3) ===ArrayIterator=== int(1) int(1) int(2) int(2) int(3) int(3)
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/ktFmQ on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/ktFmQ on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ktFmQ on line 6
Process exited with code 255.