3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(0, 9); $it = new ArrayIterator($array); $lim = new LimitIterator($array, 3, 4); $lim->seek(3); var_dump(iterator_to_array($lim));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: LimitIterator::__construct(): Argument #1 ($iterator) must be of type Iterator, array given in /in/4Ri1S:4 Stack trace: #0 /in/4Ri1S(4): LimitIterator->__construct(Array, 3, 4) #1 {main} thrown in /in/4Ri1S on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to LimitIterator::__construct() must implement interface Iterator, array given in /in/4Ri1S:4 Stack trace: #0 /in/4Ri1S(4): LimitIterator->__construct(Array, 3, 4) #1 {main} thrown in /in/4Ri1S on line 4
Process exited with code 255.
Output for 5.3.1 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Catchable fatal error: Argument 1 passed to LimitIterator::__construct() must implement interface Iterator, array given in /in/4Ri1S on line 4
Process exited with code 255.

preferences:
193.46 ms | 402 KiB | 259 Q