Be aware that counting over NoRewindIterator will make items unavailable:
<?php
$iterator = new ArrayIterator(['recipe'=>'pancakes', 'egg', 'milk', 'flour']);
$iterator = new NoRewindIterator($iterator);
var_dump($iterator->current());
var_dump(iterator_count($iterator));
var_dump($iterator->current());
$iterator->rewind(); // Does not work because it's NoRewindIterator
var_dump($iterator->current());
var_dump(iterator_count($iterator));
?>
Output:
<?php
/*
string(8) "pancakes"
int(4)
NULL
NULL
*/
int(0)
?>