iterator_to_array()
function iterator_to_array(traversable $iterator, bool $preserve_keys = true): array
Copy the iterator into an array.
Parameters:
$iterator(traversable)$preserve_keys(bool), defaulttrue, optional
Returns: array
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how iterator_to_array is implemented in the compiler, see the internals page.