Hello internals,

I'd like to propose two new functions for PHP 7.3: iterable_to_array() and
iterable_count()

These functions are supposed to work with iterables (7.1 pseudotype) - both
arrays and iterators, unlike iterator_*() functions which only work with
iterators.

Here's an RFC for this:
https://wiki.php.net/rfc/iterable_to_array-and-iterable_count

Note that in order to make iterable_to_array() compatible with
iterator_to_array(), `$use_keys = true` behavior is retained. Although this
is probably not a good default value as it may cause data loss, using
different default value sounds like a way worse option in terms of
consistency and compatibility.

A PR with implementation for iterable_to_array() is already submitted,
iterable_count() to be added soon.

Looking forward for your feedback.

Thanks!
Michael Moravec

Reply via email to