Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3965 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16369 invoked from network); 14 Aug 2003 21:01:21 -0000 Received: from unknown (HELO prp0.prp.physik.tu-darmstadt.de) (130.83.243.130) by pb1.pair.com with SMTP; 14 Aug 2003 21:01:21 -0000 Received: from prp0.prp.physik.tu-darmstadt.de (localhost [127.0.0.1]) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id h7EL1HE7026578; Thu, 14 Aug 2003 23:01:17 +0200 Received: (from swalk@localhost) by prp0.prp.physik.tu-darmstadt.de (8.12.3/8.12.3/Submit) id h7EL1HRi026577; Thu, 14 Aug 2003 23:01:17 +0200 Date: Thu, 14 Aug 2003 23:01:17 +0200 To: walt boring Cc: internals@lists.php.net Message-ID: <20030814210117.GA26541@prp0.prp.physik.tu-darmstadt.de> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F3BDC4A.20603@3gstech.com> User-Agent: Mutt/1.3.27i Subject: Re: [PHP-DEV] variable_exists() patch From: swalk@prp.physik.tu-darmstadt.de (Stefan Walk) 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. -- Regards, Stefan Walk