Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69185 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63764 invoked from network); 18 Sep 2013 12:15:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2013 12:15:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.182 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 74.125.82.182 mail-we0-f182.google.com Received: from [74.125.82.182] ([74.125.82.182:64062] helo=mail-we0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/64-43258-56999325 for ; Wed, 18 Sep 2013 08:15:34 -0400 Received: by mail-we0-f182.google.com with SMTP id q59so6467630wes.13 for ; Wed, 18 Sep 2013 05:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+aPuj1WRzLPzS86IOgrSFi7QLgpLHQYelNc55dMVq5A=; b=CQ79sqrt/fhbV0DFHRstGcpIxkCU7IR/HvVC8FOOq8Lqdejlz9Hy+0i4IdtPslWnYo HUEthdUQrRBdOz4qmsp598wB57QD75o8KRwiSYn9tS8w1FfsRISsTTVk+jlzx/15kEE0 fxd32snfBRO7DniZypT9lszgwseAQOGgFlpyb1CjdpB9pvg5N4qJURjjD3PMaJ3arCAF +MhDP8C9TKytr1e9lSOTAm6VVskvy/9AVgIP97KnebFCc7gdl4a15zyCx3M05X7Jd9GJ 3HyC3Z94rOPZed94ZhqZhNdRRG+wPkwyPFq3OSyf0fnjE8v3gEQ8VtmOv2QliNzr6rC0 YP9A== X-Received: by 10.180.74.209 with SMTP id w17mr6795221wiv.7.1379506530467; Wed, 18 Sep 2013 05:15:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.5.9 with HTTP; Wed, 18 Sep 2013 05:14:50 -0700 (PDT) In-Reply-To: <004CB360-7D96-411D-B8A2-C0E963EDCF7A@wiedler.ch> References: <004CB360-7D96-411D-B8A2-C0E963EDCF7A@wiedler.ch> Date: Wed, 18 Sep 2013 14:14:50 +0200 Message-ID: To: Igor Wiedler Cc: Leigh , PHP internals list Content-Type: multipart/alternative; boundary=f46d043749f9b6c58e04e6a7642c Subject: Re: [PHP-DEV] Allowing is_* functions to accept multiple parameters From: krebs.seb@gmail.com (Sebastian Krebs) --f46d043749f9b6c58e04e6a7642c Content-Type: text/plain; charset=ISO-8859-1 2013/9/18 Igor Wiedler > On Sep 18, 2013, at 11:53 AM, Leigh 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 --f46d043749f9b6c58e04e6a7642c--