On Feb 20, 2013, at 9:10 AM, Jim Giner <jim.gi...@albanyhandball.com> wrote:

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

That's one of the reason why I recommend using a Ternary Operator to check the 
POST array, such as:

$submit = isset($_POST['submit']) ? $_POST['submit'] : null;

That way, you never encounter an error looking for something that is not there.

Cheers,

tedd


____________________
t...@sperling.com
http://sperling.com




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

Reply via email to