[drupal-devel] PHP 101: isset() does not check for zero
length(empty) strings
Steve Dondley
sdondley at gmail.com
Fri Oct 14 12:20:05 UTC 2005
> It is well known that these are not the same.
>
> http://www.php.net/manual/en/types.comparisons.php
These are GREAT charts. Duly bookmarked.
> We have already found that is_null is slower but equals to === NULL so use
> the latter. In the table referenced above !isset always equals to is_null,
> so I propose to use !isset when we want to check for, well, not being set.
>
> if ($foo) and if (isset($foo)) is not the same, often it's a shorthand for
> if(isset($foo) && $foo != 0). I think if(isset($foo) && $foo) will always
> do. Sometimes isset() can be ommited because we know $foo is set.
>
> Regards
>
> NK
>
--
Dondley Communications
http://www.dondleycommunications.com
Communicate or Die: American Labor Unions and the Internet
http://www.communicateordie.com
More information about the drupal-devel
mailing list