Re: Proposal: Adding functions any(iterable $input, ?callable $cb = null, int $use_flags=0) and all(...)
| From: | tyson andre | Date: | Sat, 29 Aug 2020 23:18:41 +0000 |
| Subject: | Re: Proposal: Adding functions any(iterable $input, ?callable $cb = null, int $use_flags=0) and all(...) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111714@lists.php.net to get a copy of this message | ||
Hi Alex,
> I like it!
>
> What is the $use_flags parameter for?
It's for deciding what parameters to pass to callback, like https://www.php..net/array_filter - the reflection name
should probably just be $flag
Occasionally, the key might be useful to check against, e.g. the identifier of an item in a map, or
SplObjectStorage.
- the default is
any($iterable, fn ($value) => ...)
- or any($iterable, fn ($key) => expr, ARRAY_FILTER_USE_KEY)
- or any($iterable, fn ($value, $key) => expr, ARRAY_FILTER_USE_BOTH)
Thanks,
- Tyson