3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = new ArrayObject(array(1, 2)); $it = $array->getIterator(); while ($it->valid()) { $it->next(); echo $it->offsetGet(0); } $it->append(3); echo $it->valid() ? $it->current() : "not valid";
Output for 5.0.0 - 5.0.5, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
113
Output for 5.2.0 - 5.6.21
11 Catchable fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in /in/S2mi9 on line 14
Process exited with code 255.
Output for 5.1.0 - 5.1.6
11 Fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in /in/S2mi9 on line 14
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/S2mi9 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/S2mi9 on line 3