(PHP 5 >= 5.1.0)
iterator_count — Count the elements in an iterator
The iterator being counted.
The number of elements in iterator.
Example #1 iterator_count() example
<?php
$iterator = new ArrayIterator(array('recipe'=>'pancakes', 'egg', 'milk', 'flour'));
var_dump(iterator_count($iterator));
?>
The above example will output:
int(4)