3v4l.org

run code in 200+ PHP versions simultaneously
<?php echo "ArrayObject:\n"; $arrayobject = new ArrayObject([1, 2, 3]); foreach ($arrayobject as $i) { var_dump($i); } foreach ($arrayobject as $i) { var_dump($i); } echo "ArrayIterator:\n"; $arrayiterator = new ArrayIterator([1, 2, 3]); foreach ($arrayiterator as $i) { var_dump($i); } foreach ($arrayiterator as $i) { var_dump($i); }