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

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

Reply via email to