Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69183 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45527 invoked from network); 18 Sep 2013 11:15:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2013 11:15:24 -0000 Authentication-Results: pb1.pair.com header.from=igor@wiedler.ch; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=igor@wiedler.ch; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain wiedler.ch from 217.26.49.174 cause and error) X-PHP-List-Original-Sender: igor@wiedler.ch X-Host-Fingerprint: 217.26.49.174 mxout014.mail.hostpoint.ch Received: from [217.26.49.174] ([217.26.49.174:46745] helo=mxout014.mail.hostpoint.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/50-43258-A4B89325 for ; Wed, 18 Sep 2013 07:15:23 -0400 Received: from [10.0.2.45] (helo=asmtp012.mail.hostpoint.ch) by mxout014.mail.hostpoint.ch with esmtp (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1VMFj5-0006ra-5D; Wed, 18 Sep 2013 13:15:19 +0200 Received: from [84.73.218.139] (helo=[10.0.1.62]) by asmtp012.mail.hostpoint.ch with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1VMFj4-0006nF-Vw; Wed, 18 Sep 2013 13:15:19 +0200 X-Authenticated-Sender-Id: igor@wiedler.ch Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) In-Reply-To: Date: Wed, 18 Sep 2013 13:15:20 +0200 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <004CB360-7D96-411D-B8A2-C0E963EDCF7A@wiedler.ch> References: To: Leigh X-Mailer: Apple Mail (2.1510) Subject: Re: [PHP-DEV] Allowing is_* functions to accept multiple parameters From: igor@wiedler.ch (Igor Wiedler) On Sep 18, 2013, at 11:53 AM, Leigh wrote: > Hi Internals. >=20 > How do you feel about expanding the is_* functions to accept multiple > parameters similar to the way isset() already does? >=20 > ... >=20 > 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(...); } 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. Igor