3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = new ArrayObject(array(1, 2, 3)); $b = $a->getIterator(); var_dump(iterator_to_array(new LimitIterator($b, 20, -1)));
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught OutOfBoundsException: Seek position 20 is out of range in /in/gPmBO:4 Stack trace: #0 [internal function]: ArrayIterator->seek(20) #1 [internal function]: LimitIterator->rewind() #2 /in/gPmBO(4): iterator_to_array(Object(LimitIterator)) #3 {main} thrown in /in/gPmBO on line 4
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Uncaught exception 'OutOfBoundsException' with message 'Seek position 20 is out of range' in /in/gPmBO:4 Stack trace: #0 /in/gPmBO(4): LimitIterator->rewind() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.1.5 - 5.6.28
Notice: ArrayIterator::seek(): Array was modified outside object and internal position is no longer valid in /in/gPmBO on line 4 Fatal error: Uncaught exception 'OutOfBoundsException' with message 'Seek position 20 is out of range' in /in/gPmBO:4 Stack trace: #0 [internal function]: ArrayIterator->seek(20) #1 [internal function]: LimitIterator->rewind() #2 /in/gPmBO(4): iterator_to_array(Object(LimitIterator)) #3 {main} thrown in /in/gPmBO on line 4
Process exited with code 255.
Output for 5.1.3 - 5.1.4
Notice: ArrayIterator::seek(): Array was modified outside object and internal position is no longer valid in /in/gPmBO on line 4 Fatal error: Couldn't execute method LimitIterator::valid in Unknown on line 0
Process exited with code 255.
Output for 5.1.0 - 5.1.2
Notice: ArrayIterator::seek(): Array was modified outside object and internal position is no longer valid in /in/gPmBO on line 4 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function iterator_to_array() in /in/gPmBO on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/gPmBO on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/gPmBO on line 2