← All docs

iterator_apply()

Call a function for every element in an iterator.

iterator_apply()

function iterator_apply(traversable $iterator, callable $callback, array $args = null): int

Call a function for every element in an iterator.

Parameters:

  • $iterator (traversable)
  • $callback (callable)
  • $args (array), default null, optional

Returns: int

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

Internals

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