Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13430 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97530 invoked by uid 1010); 21 Oct 2004 15:03:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 94650 invoked from network); 21 Oct 2004 15:03:07 -0000 Received: from unknown (HELO moray.dnsvelocity.com) (64.21.80.13) by pb1.pair.com with SMTP; 21 Oct 2004 15:03:07 -0000 Received: from nobody by moray.dnsvelocity.com with local (Exim 4.41) id 1CKeSd-0000do-0L; Thu, 21 Oct 2004 15:02:39 +0000 Received: from 204.64.28.150 (SquirrelMail authenticated user dv@josheli.com); by mail.josheli.com with HTTP; Thu, 21 Oct 2004 10:02:38 -0500 (CDT) Message-ID: <4256.204.64.28.150.1098370958.squirrel@204.64.28.150> In-Reply-To: <20041021141518.53657.qmail@pb1.pair.com> References: <20041020110454.29582.qmail@pb1.pair.com> <20041020111321.56801.qmail@pb1.pair.com> <20041020112139.91563.qmail@pb1.pair.com> <008c01c4b6f6$4fd9a450$0a00a8c0@home.jevon.org> <20041021141518.53657.qmail@pb1.pair.com> Date: Thu, 21 Oct 2004 10:02:38 -0500 (CDT) To: "Ron Korving" Cc: internals@lists.php.net Reply-To: dv@josheli.com User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - moray.dnsvelocity.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [99 32712] / [47 12] X-AntiAbuse: Sender Address Domain - josheli.com X-Source: X-Source-Args: /usr/local/apache/bin/httpd -DSSL X-Source-Dir: josheli.com:/public_html/mail/src Subject: Re: [PHP-DEV] suggestion: empty() with infinite parameters like isset() From: dv@josheli.com ("David Vance") if(any_empty($var1, $var2, $var3)) return "there's an empty var"; if(!any_empty($var1, $var2, $var3)) return "there's no empty vars"; if (all_set($var1, $var2, $var3)) return "all vars are set"; if (!all_set($var1, $var2, $var3)) return "there's an unset var"; but how would you find out which var's, if any, are empty or not set? otherwise, would seem not very useful... if(!all_set($var1, $var2, $var3)){ if(!isset($var1)){ echo 'it was 1'; } if(!isset($var2)){ echo 'it was 2'; } if(!isset($var3)){ echo 'it was 3'; } } On Thu, October 21, 2004 9:13 am, Ron Korving said: > I'm not really anxcious to have an anyempty() function, but I do think > empty() should behalve like an allempty() just like isset() behaves like > an > areallset(). I guess the "weirdness" is in the fact that isset() will give > a > positive reply when something exists, while empty() gives a negative reply > when something exists. I guess this creates the confusion and would make > the > allempty() functionality less likely to be used often. I guess people will > want to check more often if all their vars are set, and therefor an "or" > situation instead of "and" would be more suitable, because then you could > do: if (empty($var1, $var2, $var3)) echo "there's an empty var"; > I'd personally prefer the "and" situation, but it's a fact that this would > make it far less useful than the "or". So I can see the confusion and the > reason to just stick with 1 parameter. > > I guess there should just be a function like isset() which returns > !empty(). > Maybe it should be called isval() or something. Then it could be used for > several vars without confusion: > if (!isval($var1, $var2, $var3)) return "there's an empty var"; > > This would make sense to everybody I think, because like isset() it would > be > an "and" situation. > > Ron > > > "Jevon Wright" wrote in message > news:008c01c4b6f6$4fd9a450$0a00a8c0@home.jevon.org... >> How about anyempty($var1, $var2, $var3, ...) ? >> >> Jevon >> >> ----- Original Message ----- >> From: "Ron Korving" >> To: >> Sent: Thursday, October 21, 2004 12:21 AM >> Subject: Re: [PHP-DEV] suggestion: empty() with infinite parameters like >> isset() >> >> >> > Maybe it was a bad example. Writing "data missing" I was thinking that > at >> > least one variable should be set. >> > >> > Ron >> > >> > "Derick Rethans" schreef in bericht >> > news:Pine.LNX.4.58.0410201315360.1991@localhost... >> > > On Wed, 20 Oct 2004, Ron Korving wrote: >> > > >> > > > Okay, I don't wanna make remarks that may have already been made >> > earlier, >> > > > but I think it should be "all should be empty", because it works >> exactly >> > the >> > > > same for isset(), and apparently, a decision was made to give > isset() >> > that >> > > > feature. >> > > >> > > Right, but then your example would already no longer have worked: >> > > >> > > if (empty($var1, $var2, $var3)) echo "data missing"; >> > > >> > > so there is no point in adding it like that. >> > > >> > > Derick >> > > >> > > -- >> > > Derick Rethans >> > > http://derickrethans.nl | http://ez.no | http://xdebug.org >> > >> > -- >> > PHP Internals - PHP Runtime Development Mailing List >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >