An open API service indexing awesome lists of open source software.

https://github.com/kuria/iterable

Utilities for dealing with PHP's iterators and the iterable type
https://github.com/kuria/iterable

array iterable list php

Last synced: about 2 months ago
JSON representation

Utilities for dealing with PHP's iterators and the iterable type

Awesome Lists containing this project

README

          

Iterable
########

Utilities for dealing with PHP's iterators and the iterable type.

.. image:: https://travis-ci.com/kuria/iterable.svg?branch=master
:target: https://travis-ci.com/kuria/iterable

.. contents::

Features
********

- converting iterable values to arrays
- caching iterator

Requirements
************

- PHP 7.1+

Usage
*****

``IterableHelper::toArray()``
=============================

Convert an iterable value to an array.

.. code:: php

`_
or other non-rewindable traversables.

.. code:: php

29
[1] => 107
[2] => 249
)
Array
(
[0] => 29
[1] => 107
[2] => 249
)
int(3)

.. NOTE::

Your numbers will vary, but the output is meant to demonstrate that
the yielded pairs have indeed been cached.