Re: if (empty versus if (isset

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

 



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).

They seem to be needlessly redundant, but in fact do provide knowledge for those seeking it.

--
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