Zend\Stdlib\ArrayUtils::iteratorToArray
Convert an iterator to an array.
Converts an iterator to an array. The $recursive flag, on by default, hints whether or not you want to do so recursively.
Signature
public function iteratorToArray(array|Traversable
$iterator,
[bool
$recursive = true] )
Parameters
$iterator
— object- The array or Traversable object to convert
$recursive
— object- Recursively check all nested structures
Returns
- array
Errors/Exceptions
-
InvalidArgumentException
- if $iterator is not an array or a Traversable object