Home > PHP > Function > SPL > iterator_to_array()

iterator_to_array()

iterator_to_array - Copy the iterator into an array

Syntax

array iterator_to_array (Traversable $iterator, bool $use_keys)

Arguments

  • iterator - The iterator being copied.
  • use_keys - Whether to use the iterator element keys as index.

Description

Copy the elements of an iterator into an array.

Version

PHP 5.1.0

Return value

An array containing the elements of the iterator.