Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69180 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34255 invoked from network); 18 Sep 2013 09:53:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2013 09:53:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.177 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 209.85.212.177 mail-wi0-f177.google.com Received: from [209.85.212.177] ([209.85.212.177:56530] helo=mail-wi0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/24-13799-82879325 for ; Wed, 18 Sep 2013 05:53:45 -0400 Received: by mail-wi0-f177.google.com with SMTP id cb5so6186264wib.16 for ; Wed, 18 Sep 2013 02:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=+fy/AHNG2XVwKIkIjfr0m7j8hsfjNBJ1rLs9X057YAI=; b=GZV1NkRHS+2CFHVQH22UeQN4Hexs4LrqoD7WhBK1UFV5sPxLiE1GHgfwB9DiA61ez2 BTIZulBgDOgJWLDTZr+LjFqFFOtVzUVyguG3NUvF2XElsi8JQjO8NQo4gFE1Yuzrg/KU s1wq7Isxs6Cnb2YUzQ5cb6CYXhp4DsasC9XFuS9HrV6pO1OdqpIBqpiug9lAU5KmVlmY xwDpfYxWvaI6iiufOsarC85XAyix87BIpvmfvU9Yf6975wo0Ls4ozE14eDWKt2Mv+MMO CbODhm0KtLxyc33me0hIEmusB4PktkTOcfuY3qVmAV7wMQj7uFOEqrirYa8lFbn6yUUd nCgA== MIME-Version: 1.0 X-Received: by 10.181.11.163 with SMTP id ej3mr6215637wid.47.1379498020788; Wed, 18 Sep 2013 02:53:40 -0700 (PDT) Received: by 10.216.184.3 with HTTP; Wed, 18 Sep 2013 02:53:40 -0700 (PDT) Date: Wed, 18 Sep 2013 10:53:40 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d043be1e07f630c04e6a56933 Subject: Allowing is_* functions to accept multiple parameters From: leight@gmail.com (Leigh) --f46d043be1e07f630c04e6a56933 Content-Type: text/plain; charset=ISO-8859-1 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? --f46d043be1e07f630c04e6a56933--