iterator_to_array

Supported Versions: PHP 5 >= 5.1.0, PHP 7, PHP 8
Copy the iterator into an array
<?php iterator_to_array(Traversable|array $iterator, bool $preserve_keys = true): array
<?php     public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested)

    {

        $a += iterator_to_array($c);



        return $a;

    }
<?php     public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested)

    {

        $a += [

            Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),

        ];



        return $a;
<?php         $a += [

            $prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode),

            $prefix.'dllist' => iterator_to_array($c),

        ];

        $c->setIteratorMode($mode);