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             ['foo', 1],

            ['bar', 2],

            ['baz', 3],

        ], iterator_to_array($this->connection->iterateNumeric($this->query)));

    }



    public function testIterateAssociative(): void
<?php                 'a' => 'baz',

                'b' => 3,

            ],

        ], iterator_to_array($this->connection->iterateAssociative($this->query)));

    }



    public function testIterateKeyValue(): void
<?php             'foo' => 1,

            'bar' => 2,

            'baz' => 3,

        ], iterator_to_array($this->connection->iterateKeyValue($this->query)));

    }



    public function testIterateKeyValueOneColumn(): void
<?php             ->getDummySelectSQL();



        $this->expectException(NoKeyValue::class);

        iterator_to_array($this->connection->iterateKeyValue($sql));

    }



    public function testIterateAssociativeIndexed(): void
<?php             'foo' => ['b' => 1],

            'bar' => ['b' => 2],

            'baz' => ['b' => 3],

        ], iterator_to_array($this->connection->iterateAssociativeIndexed($this->query)));

    }



    public function testIterateColumn(): void
<?php             'foo',

            'bar',

            'baz',

        ], iterator_to_array($this->connection->iterateColumn($this->query)));

    }

}