nikic/iter — pull request #16 by camspiers (2014-01-30 04:05:44+00:00)
Title: Recursive cousins for toArray and toArrayWithKeys

Recursively converts iterables into arrays, without preserving keys.

Each traversable value that is encountered turned into an array recursively

Examples:

iter\toArrayRecursive(new \ArrayIterator([new \ArrayIterator([1, 2, 3]), 2, 3]))
=> [[1, 2, 3], 2, 3]

Recursively converts iterables into arrays preserving their keys.

Each traversable value that is encountered turned into an array recursively

Examples:

iter\toArrayRecursiveWithKeys(
new \ArrayIterator(['a' => new \ArrayIterator(['a' => 1, 'b' => 2, 'c' => 3]), 'c' => 2, 'c' => 3])
)
=> ['a' => ['a' => 1,'b' => 2, 'c' => 3], 'b' => 2, 'c' => 3]