← All docs

iterator_count()

Count the elements in an iterator.

iterator_count()

function iterator_count(traversable $iterator): int

Count the elements in an iterator.

Parameters:

  • $iterator (traversable)

Returns: int

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how iterator_count is implemented in the compiler, see the internals page.