Re: Variadic is_*() functions
| From: | Christoph M. Becker | Date: | Mon, 11 Feb 2019 16:40:05 +0000 |
| Subject: | Re: Variadic is_*() functions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104346@lists.php.net to get a copy of this message | ||
On 11.02.2019 at 16:59, Levi Morrison wrote:
> 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']])) {/*...*/}
>
> These do not need to be part of PHP core, but perhaps they could be.
>
> I recognize that there is one downside, which is that lazy evaluation
> is lost, but generally don't see it to be an issue in these specific
> cases.
See <https://github.com/php/php-src/pull/1385>,
which has been abanoned,
though.
--
Christoph M. Becker