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
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/array/iterator_to_array.rs).
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.