iterator_count Count the elements in an iterator &reftitle.description; intiterator_count Traversablearrayiterator Count the elements in an iterator. iterator_count is not guaranteed to retain the current position of the iterator. &reftitle.parameters; iterator The iterator being counted. &reftitle.returnvalues; The number of elements in iterator. &reftitle.changelog; &Version; &Description; 8.2.0 The type of iterator has been widened from Traversable to Traversablearray. &reftitle.examples; <function>iterator_count</function> example 'pancakes', 'egg', 'milk', 'flour')); var_dump(iterator_count($iterator)); ?> ]]> &example.outputs; <function>iterator_count</function> modifies position current()); var_dump(iterator_count($iterator)); var_dump($iterator->current()); ?> ]]> &example.outputs; <function>iterator_count</function> in &foreach; loops $value) { echo "$key: $value (", iterator_count($iterator), ")\n"; }?> ]]> &example.outputs;