3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(1,2,3,4,5,6,7,8,9,10); foreach (new LimitIterator(new InfiniteIterator(new ArrayIterator($a)), 2, count($a)) as $v) { echo $v; }
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
34567891012
Output for 5.0.1 - 5.0.5
Fatal error: Class 'InfiniteIterator' not found in /in/uAd3h on line 4 Fatal error: Unknown: The inner constructor wasn't initialized with an iterator instance in Unknown on line 0
Process exited with code 255.
Output for 5.0.0
Fatal error: Class 'InfiniteIterator' not found in /in/uAd3h on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: limititerator in /in/uAd3h on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: limititerator in /in/uAd3h on line 4