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 <[EMAIL PROTECTED]>                        +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 ====-----




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to