Re: Re: if (empty versus if (isset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxx

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

http://www.behnke.biz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux