2013/9/18 Igor Wiedler <i...@wiedler.ch>

> On Sep 18, 2013, at 11:53 AM, Leigh <lei...@gmail.com> wrote:
>
> > Hi Internals.
> >
> > How do you feel about expanding the is_* functions to accept multiple
> > parameters similar to the way isset() already does?
> >
> > ...
> >
> > Thoughts?
>
> For isset() there is a good reason to do this, because the var might not
> exist at all, and as such you cannot use a function, as it would produce
> warnings.
>
> However, for is_* functions, this could easily be done with a higher-order
> "every" function. You pass a predicate and an array of values. It returns a
> boolean.
>
> Example:
>
>         if (!every('is_int', $numbers)) {
>                 throw new \InvalidArgumentException(...);
>         }
>

Actually it was about multiple parameters

    if (!every('is_int', $a, $b, $c)) { /* .. */ }

To me using `is_int()` directly feels more intuitive too.

    if (!is_int($a, $b, $c)) { /* .. */ }



>
> Not only is that much cleaner in my opinion, it also is composable without
> having to change *all* of the is_* predicates.
>
> As such, I don't see much value in changing this.
>

Well, asking me that sounds like the same value like it is for
array_column(). It is a minor improvement, but it is an useful one (imo).

Just my 2 cent


Regards,
Sebastian


> Igor
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
github.com/KingCrunch

Reply via email to