Re: Re: if (empty versus if (isset
| From: | marco@behnke.biz | Date: | Wed, 20 Feb 2013 15:51:46 +0000 |
| Subject: | Re: Re: if (empty versus if (isset | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320258@lists.php.net to get a copy of this message | ||
> Jim Giner <jim.giner@albanyhandball.com> hat am 20. Februar 2013 um 15:10
> geschrieben:
>
>
> Basically it tells a savvy programmer whether or not his logic has
> caused the var in question to "exist". Many times it is important
> simply to know that, not what the var contains, which can lead to an
> error in processing.
>
> The isset() will tell you that "yes, I have this variable", letting you
> then correctly interpret the contents. If a $_POST var is not set
> (meaning the user made no input to it), the use of empty() will insist
> on telling you that the var is empty even tho it really was not provided
> by the user (assuming that you don't get an error msg for having an
> invalid index in the POST array).
keep in mind that isset returns false if the variable exists, but has a value of
null. The same applies to existing array keys with value null.
>
> They seem to be needlessly redundant, but in fact do provide knowledge
> for those seeking it.
No, they are not as I wrote in my last message
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: marco@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz