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); }

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
ArrayObject: int(1) int(2) int(3) int(1) int(2) int(3) ArrayIterator: int(1) int(2) int(3) int(1) int(2) int(3)
Output for Arrow functions
ArrayObject: int(1) int(2) int(3) int(1) int(2) int(3) ArrayIterator: int(1) int(2) int(3) int(1) int(2) int(3)
Output for Object typehint
ArrayObject: int(1) int(2) int(3) int(1) int(2) int(3) ArrayIterator: int(1) int(2) int(3) int(1) int(2) int(3)
Output for Array change keys
ArrayObject: int(1) int(2) int(3) int(1) int(2) int(3) ArrayIterator: int(1) int(2) int(3) int(1) int(2) int(3)
Output for Lexical anon
ArrayObject: int(1) int(2) int(3) int(1) int(2) int(3) ArrayIterator: int(1) int(2) int(3) int(1) int(2) int(3)

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