3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $items = new ArrayObject(range(1,11)); echo 'there are ' . $items->count() . ' total items' . "\r\n"; $cachingIterator = new CachingIterator($items->getIterator()); $limitIterator = new LimitIterator($cachingIterator, 0, 10); $i = 0; foreach ($limitIterator as $item) { ++$i; } echo 'first page has ' . $i . ' items' . "\r\n"; if ($cachingIterator->hasNext()) { echo 'there is a next page'; } else { echo 'there is no next page'; }
Output for 5.0.0 - 7.1.0
there are 11 total items first page has 10 items there is no next page
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/8RRAY on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/8RRAY on line 3