Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82606 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98628 invoked from network); 13 Feb 2015 11:41:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Feb 2015 11:41:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=tpunt@hotmail.co.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tpunt@hotmail.co.uk; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.co.uk designates 157.55.2.80 as permitted sender) X-PHP-List-Original-Sender: tpunt@hotmail.co.uk X-Host-Fingerprint: 157.55.2.80 dub004-omc4s5.hotmail.com Received: from [157.55.2.80] ([157.55.2.80:59207] helo=DUB004-OMC4S5.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/37-62214-EF2EDD45 for ; Fri, 13 Feb 2015 06:41:51 -0500 Received: from DUB113-W79 ([157.55.2.71]) by DUB004-OMC4S5.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Fri, 13 Feb 2015 03:41:43 -0800 X-TMN: [L3UM4DQIQbELDJ9Na+wTfvL0FRaJI7GV] X-Originating-Email: [tpunt@hotmail.co.uk] Message-ID: Content-Type: multipart/alternative; boundary="_d1bc924a-bf1c-4fad-989d-5bec4d98414c_" To: Andrea Faulds , Michael Wallner CC: "internals@lists.php.net" Date: Fri, 13 Feb 2015 11:41:43 +0000 Importance: Normal In-Reply-To: <1E15BAAB-C8FC-49A9-B73F-E0E7DEFA208D@ajf.me> References: <54DDA797.4030501@php.net> ,<1E15BAAB-C8FC-49A9-B73F-E0E7DEFA208D@ajf.me> MIME-Version: 1.0 X-OriginalArrivalTime: 13 Feb 2015 11:41:43.0813 (UTC) FILETIME=[0A50C350:01D04782] Subject: RE: [PHP-DEV] [DISCUSSION] Make empty() a Variadic From: tpunt@hotmail.co.uk (Thomas Punt) --_d1bc924a-bf1c-4fad-989d-5bec4d98414c_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi=2C > From: ajf@ajf.me> > * I assume Thomas actually meant =93where if any arguments passed in are = considered empty=2C then *true* is returned=94=2C i.e. (empty($a) || empty(= $b) || empty($c)) >=20 > Sorry for the confusion. >=20 > I think the || behaviour is the most useful=2C as it=92s the analogue of = isset=92s. So !empty($a=2C $b=2C $c) would work similarly to isset($a=2C $b= =2C $c)=2C and similarly=2C !isset($a=2C $b=2C $c) would work similarly to = empty($a=2C $b=2C $c). >=20 > But that=92s just my opinion. :) > -- > Andrea Faulds > http://ajf.me/ Yeah=2C my mistake. That's what I meant - empty will return TRUE if *any* o= f its arguments are considered empty=2C and FALSE otherwise. So the followi= ng two pieces of code are analogous: # this:if (empty($a) || empty($b) || empty($c)) {// error here} # is the same as this:if (empty($a=2C $b=2C $c)) {// error here} # and this:if (!empty($a) && !empty($b) && !empty($c)) {// all good!} # is the same as this:if (!empty($a=2C $b=2C $c)) {// all good!} Sorry for the confusion :p -Tom = --_d1bc924a-bf1c-4fad-989d-5bec4d98414c_--