Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3966 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20333 invoked from network); 14 Aug 2003 21:11:39 -0000 Received: from unknown (HELO pd3mo2so.prod.shaw.ca) (24.71.223.10) by pb1.pair.com with SMTP; 14 Aug 2003 21:11:39 -0000 Received: from pd5mr3so.prod.shaw.ca (pd5mr3so-qfe3.prod.shaw.ca [10.0.141.144]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HJM00EJBNY1W5@l-daemon> for internals@lists.php.net; Thu, 14 Aug 2003 15:06:01 -0600 (MDT) Received: from pn2ml7so.prod.shaw.ca (pn2ml7so-qfe0.prod.shaw.ca [10.0.121.151]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HJM002PUNY1WY@l-daemon> for internals@lists.php.net; Thu, 14 Aug 2003 15:06:01 -0600 (MDT) Received: from h24-84-221-8.vc.shawcable.net (h24-84-221-8.vc.shawcable.net [24.84.221.8]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003)) with ESMTP id <0HJM00N6RNY12S@l-daemon> for internals@lists.php.net; Thu, 14 Aug 2003 15:06:01 -0600 (MDT) Date: Thu, 14 Aug 2003 14:05:29 -0700 In-reply-to: <20030814210117.GA26541@prp0.prp.physik.tu-darmstadt.de> To: Stefan Walk Cc: walt boring , internals@lists.php.net Message-ID: <1060895128.3102.103.camel@ali> Organization: MIME-version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Content-type: text/plain Content-transfer-encoding: 7BIT References: <1060813541.901.336.camel@ali> <200308141145.38495.ilia@prohost.org> <3F3BD1D7.70209@3gstech.com> <20030814182806.GA25430@prp0.prp.physik.tu-darmstadt.de> <3F3BDC4A.20603@3gstech.com> <20030814210117.GA26541@prp0.prp.physik.tu-darmstadt.de> Subject: Re: [PHP-DEV] variable_exists() patch From: torben@php.net (Lars Torben Wilson) On Thu, 2003-08-14 at 14:01, Stefan Walk wrote: > On Thu, Aug 14, 2003 at 12:00:26PM -0700, walt boring wrote: > > It can happen quite easily. I always develop with full warnings/errors on. > > So do I. > > > So if for example a var isn't set for whatever reason, then trying to > > access the > > variable will throw a php Notice. variable_exists() would prevent that, > > as does isset(). > > Correct, isset works. > > > isset() would work for my example below, but it still is a 'broken' > > function in my opinion. > > > > if ($var) { // <-- you'll get a php notice on this line > > switch ($var) { > > ... > > } > > > > } > > > > versus doing > > > > if (variable_exists($var)) { //no php notices here > > switch($var) { > > ... > > } > > } > > As you already stated, isset works also. I asked for an occasion where > your variable_exists would be useful because isset does not work. > > DB arguments don't count, if a value is null in a database it is > considered - you guessed it - not set. > > I simply don't see a need for this. I have posted several examples, complete with code and output. -- Torben Wilson +1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com -----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----