<?php
$i = new ArrayIterator(array(1,7,9));
$ci = new CachingIterator($i, CachingIterator::FULL_CACHE);
foreach($ci as $value) {
echo $value . PHP_EOL;
dump($ci->getCache());
}
^ array:1 [
0 => 1
]
^ array:2 [
0 => 1
1 => 7
]
^ array:3 [
0 => 1
1 => 7
2 => 9
]