Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69181 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35686 invoked from network); 18 Sep 2013 09:55:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2013 09:55:48 -0000 Authentication-Results: pb1.pair.com header.from=nvartolomei@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nvartolomei@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.181 as permitted sender) X-PHP-List-Original-Sender: nvartolomei@gmail.com X-Host-Fingerprint: 209.85.215.181 mail-ea0-f181.google.com Received: from [209.85.215.181] ([209.85.215.181:61974] helo=mail-ea0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/74-13799-4A879325 for ; Wed, 18 Sep 2013 05:55:48 -0400 Received: by mail-ea0-f181.google.com with SMTP id d10so3356286eaj.12 for ; Wed, 18 Sep 2013 02:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-type:content-transfer-encoding :content-disposition; bh=80QJZiFwUHpI7EpZsWlMc9q0aRxZJunKYJaTxApWiUw=; b=hVVfuOeSYkcKnFa6/JfL3uLEPCfOf/DeY7+lt/xvYEWXbdEUVg1kx86U9eJ3zxuMil n/ie0mXqtXVVke2AGwvPM6nSY12+wLwo+OzMmvfx3B95td9D7AkK/etzlelHS3VWiH2n R5DqyH3JocH0bNJh7KyAMEBTPTBeLlA3Nx1APV5lfSsrThL5LGTZZEmS+YzD/3UEtWAT I0SQiT+Jwae36VKuEvoFMJxqZeaVa3TULJTm0ZE2BJIMOrWbx6ox+HPixmGKFYqOgWkw aYyQqel6USQYGQCrBrEajdLqQSG4RCIvk6VwsjnXy5zwoimhIfkAtf5nZCg6032tfXbS 0jRA== X-Received: by 10.15.35.196 with SMTP id g44mr58826023eev.18.1379498145609; Wed, 18 Sep 2013 02:55:45 -0700 (PDT) Received: from Pro ([178.168.103.7]) by mx.google.com with ESMTPSA id bn13sm1428445eeb.11.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 18 Sep 2013 02:55:45 -0700 (PDT) Date: Wed, 18 Sep 2013 12:55:43 +0300 To: Leigh Cc: internals@lists.php.net Message-ID: <49D57F66323040FC9AE48244DAAF3771@gmail.com> In-Reply-To: References: X-Mailer: sparrow 1.5 (build 1043.1) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: Allowing is_* functions to accept multiple parameters From: nvartolomei@gmail.com (Vartolomei Nicolae) On Wednesday, September 18, 2013 at 12:53 PM, Leigh wrote: > Hi Internals. > > How do you feel about expanding the is_* functions to accept multiple > parameters similar to the way isset() already does? > > From the manual: "If multiple parameters are supplied then isset() will > return TRUE only if all of the parameters are set. Evaluation goes from > left to right and stops as soon as an unset variable is encountered." > > I am proposing that all of the is_* functions are allowed to take a > variable number of parameters and will return true if all of the arguments > satisfy what is being checked. > > i.e. is_null($a, $b, $c) would be the same as is_null($a) && is_null($b) > && is_null($c) > > As well as producing much more succinct code and less function call > overhead, I think this ties in nicely with the variadic and unpacking RFCs > and is especially useful for parameters that cannot be typehinted; for > example you would be able to something like: > > function doStuffWithNumbers(...$numbers) { > if (!is_int(...$numbers)) { > throw new InvalidArgumentException('blah'); > ... > > Thoughts? are_int() kindly, nvartolomei =)