<?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';
}