3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $list = new ArrayIterator(); $listCloned = clone $list; $list->append("primeiro valor"); $listCloned->append("segundo valor"); var_dump($list , $listCloned);
based on 0OKe3
Output for 7.0.5 - 7.1.0
object(ArrayIterator)#1 (1) { ["storage":"ArrayIterator":private]=> array(2) { [0]=> string(14) "primeiro valor" [1]=> string(13) "segundo valor" } } object(ArrayIterator)#2 (1) { ["storage":"ArrayIterator":private]=> object(ArrayIterator)#1 (1) { ["storage":"ArrayIterator":private]=> array(2) { [0]=> string(14) "primeiro valor" [1]=> string(13) "segundo valor" } } }
Output for 5.3.0 - 5.6.21, 7.0.0 - 7.0.4
object(ArrayIterator)#1 (1) { ["storage":"ArrayIterator":private]=> array(2) { [0]=> string(14) "primeiro valor" [1]=> string(13) "segundo valor" } } object(ArrayIterator)#2 (1) { ["storage":"ArrayIterator":private]=> array(2) { [0]=> string(14) "primeiro valor" [1]=> string(13) "segundo valor" } }
Output for hhvm-3.12.0
object(ArrayIterator)#1 (2) { ["storage":"ArrayIterator":private]=> array(1) { [0]=> string(14) "primeiro valor" } ["flags":"ArrayIterator":private]=> int(0) } object(ArrayIterator)#2 (2) { ["storage":"ArrayIterator":private]=> array(1) { [0]=> string(13) "segundo valor" } ["flags":"ArrayIterator":private]=> int(0) }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.0.5, 5.1.3 - 5.2.17
object(ArrayIterator)#1 (2) { [0]=> string(14) "primeiro valor" [1]=> string(13) "segundo valor" } object(ArrayIterator)#2 (2) { [0]=> string(14) "primeiro valor" [1]=> string(13) "segundo valor" }
Output for 5.1.0 - 5.1.2
Fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in /in/G7Gp6 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/G7Gp6 on line 3
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/G7Gp6 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/G7Gp6 on line 3
Process exited with code 255.