Re: [PHP] Re: if (empty versus if (isset

[email protected] ("[email protected]")
Newsgroups php.general
Message-ID <[email protected]>

> Jim Giner <[email protected]> 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: [email protected]

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.