Description

Parameters

iterator

The iterator being copied.

use_keys

Whether to use the iterator element keys as index.

In PHP 5.5 and later, if a key is an array or
object, a warning will be generated. NULL keys will be
converted to an empty string, float keys will be
truncated to their integer counterpart,
resource keys will generate a warning and be converted to
their resource ID, and boolean keys will be converted to
integers.

Note:

If this parameter is not set or set to TRUE, duplicate keys will be
overwritten. The last value with a given key will be in the returned
array. Set this paramater to FALSE to get all the values
in any case.

When using iterator_to_array() on an SplObjectStorage object, it's advisable to set $use_keys to false.

The resulting array is identical, since the iterator keys produced by SplObjectStorage::key() are always integers from 0 to (COUNT-1). Passing $use_keys=false cuts out the unnecessary calls to SplObjectStorage::key(), giving a slight performance advantage.