Hi
On 6/17/22 18:06, Guilliam Xavier wrote:
https://github.com/php/php-src/pull/8819
Just so that it can't be said that it hasn't been asked: what about
iterator_count(), and iterator_apply()?
I also came across those, while implementing the PR, but I intentionally
did not touch them to keep the scope simple and because I think they are
less likely to be used generally.
- `iterator_apply()` is easily replaced by a foreach loop, because the
return value is pretty useless, so it is not likely that a nested
function call is going to be used.
- For `iterator_count()` one could to `count(iterator_to_array($foo))`
if my proposal is merged. This come with a bit of overhead, but at least
it's not as clunky as `is_array($foo) ? $foo : iterator_to_array($foo)`
If a RFC is desired, then I'd likely include all three of them with a
vote for each, but I hope my proposal is simple enough to not require an
RFC.
Best regards
Tim Düsterhus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php