Re: Variadic is_*() functions
| From: | Côme Chilliet | Date: | Tue, 12 Feb 2019 10:29:54 +0000 |
| Subject: | Re: Variadic is_*() functions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104359@lists.php.net to get a copy of this message | ||
Le lundi 11 février 2019, 08:59:17 CET Levi Morrison a écrit :
> My position is the same: pushing the variadic behavior into the
> functions means that each function needs to pick
|| or
> &&
> behavior, both of which are useful. I would rather see more
> descriptive function names, such as all_of or
> any_of:
>
> if (!all_of('is_numeric', [$input['example1'],
> $input['example2']])) {/*...*/}
My first thought was that this must already exists under another name, but it seems that none of
array_map, array_walk or array_reduce allows to do that easily.
(That is, in a more readable way than the boolean operator string, otherwise it’s useless)
Côme