Re: [PHP-DEV] Variadic is_*() functions

2019-02-12 Thread Sara Golemon
On Tue, Feb 12, 2019 at 4:30 AM Côme Chilliet wrote: > 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 i

Re: [PHP-DEV] Variadic is_*() functions

2019-02-12 Thread Côme Chilliet
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_o

Re: [PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Sara Golemon
On Mon, Feb 11, 2019 at 9:59 AM 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. > Additionally, I recall from that thread (or a similar one on the same topic

Re: [PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Chase Peeler
On Mon, Feb 11, 2019 at 11:35 AM Levi Morrison wrote: > >> 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. > >> > > Lazy evaluation doesn't have to be lost if the all_of and any_of > functi

Re: [PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Christoph M. Becker
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`: >

Re: [PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Levi Morrison
>> 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. >> > Lazy evaluation doesn't have to be lost if the all_of and any_of functions > are written correctly. all_of will return false as soon as on

Re: [PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Chase Peeler
On Mon, Feb 11, 2019 at 10:59 AM Levi Morrison wrote: > On Mon, Feb 11, 2019 at 8:39 AM Woortmann, Enno > wrote: > > > > Hi internals, > > > > as I reviewed a bunch of code for handling data from different sources > > (eg. json) in the last days I stumbled over code like this multiple > times: >

Re: [PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Levi Morrison
On Mon, Feb 11, 2019 at 8:39 AM Woortmann, Enno wrote: > > Hi internals, > > as I reviewed a bunch of code for handling data from different sources > (eg. json) in the last days I stumbled over code like this multiple times: > > > if (!(is_numeric($input['example1']) && is_numeric($input['example2

[PHP-DEV] Variadic is_*() functions

2019-02-11 Thread Woortmann, Enno
Hi internals, as I reviewed a bunch of code for handling data from different sources (eg. json) in the last days I stumbled over code like this multiple times: if (!(is_numeric($input['example1']) && is_numeric($input['example2']))) { if (!is_numeric($input['example1'] || !is_numeric($input['