Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82602 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92352 invoked from network); 13 Feb 2015 11:31:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Feb 2015 11:31:46 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:33452] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/C5-62214-F90EDD45 for ; Fri, 13 Feb 2015 06:31:44 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 51E982400E4; Fri, 13 Feb 2015 06:31:41 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Sguf0MxL14JM; Fri, 13 Feb 2015 06:31:41 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 57B762400FC; Fri, 13 Feb 2015 06:31:40 -0500 (EST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: Date: Fri, 13 Feb 2015 11:31:38 +0000 Cc: Thomas Punt , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <1E15BAAB-C8FC-49A9-B73F-E0E7DEFA208D@ajf.me> References: <54DDA797.4030501@php.net> To: Michael Wallner X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] [DISCUSSION] Make empty() a Variadic From: ajf@ajf.me (Andrea Faulds) > On 13 Feb 2015, at 11:16, Andrea Faulds wrote: >=20 > Hey, >=20 >> On 13 Feb 2015, at 07:28, Michael Wallner wrote: >>=20 >> On 12/02/15 19:55, Thomas Punt wrote: >>=20 >>> I'd like to propose to make empty() a variadic, where if any >>> arguments passed in are considered empty, then false is returned >>=20 >> Should that read "if any arguments passed in are considered *NOT* = empty, >> then false is returned=94? >=20 > No, I think it=92s correct, if confusingly phrased. I believe Thomas = is proposing variadic empty() where TRUE is returned if any of its = arguments are empty, otherwise FALSE. So, empty($a, $b, $c) would be = equivalent to empty($a) || empty($b) || empty($c), much like isset($a, = $b, $c) is equivalent to (and implemented as) isset($a) && isset($b) && = isset($c). Wait, I think I made a mistake. * Thomas proposed "if any arguments passed in are considered empty, then = false is returned=94, i.e. !(empty($a) || empty($b) || empty($c)) if his = words are taken literally. This doesn=92t make much sense, I think it = was a mistake. * You suggested he may have meant "if any arguments passed in are = considered *NOT* empty, then false is returned=94, i.e. (empty($a) && = empty($b) && empty($c)) * I assume Thomas actually meant =93where if any arguments passed in are = considered empty, then *true* is returned=94, i.e. (empty($a) || = empty($b) || empty($c)) Sorry for the confusion. I think the || behaviour is the most useful, as it=92s the analogue of = isset=92s. So !empty($a, $b, $c) would work similarly to isset($a, $b, = $c), and similarly, !isset($a, $b, $c) would work similarly to empty($a, = $b, $c). But that=92s just my opinion. :) -- Andrea Faulds http://ajf.me/