2018-07-05 16:43 GMT+02:00 Jordi Boggiano <j.boggi...@seld.be>: > Just to explain the No vote for iterable_count, I think we'd rather advocate > people implement Countable in their iterables than to force the consumption > of an iterator just to count it as this can have side-effects and render the > iterator unusable. If Countable is implemented then count() will do the job > and all is well. If consuming the iterator is desired then one still can do > count(iterable_to_array($iter)) fairly easily.
Hi, I absolutely agree. I initially started writing the RFC without iterable_count(), but later I decided to include it for completeness, so that both iterator_*() functions have a proposed alternative. Of course, and for the reasons mentioned I made a vote for each of them separately. M. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php