Re: Type of form element

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

 



Uh.... isset will work in this particular instance because $_POST is
an array whose values are of one type and one type only: STRINGS.

Yes, it is true that:
$myArray['a'] = NULL;
isSet($myArray['a']); //Will return FALSE.

However, because $_POST contains STRINGS AND STRINGS ONLY, isSet works:

$myArray['a'] = '';
$myArray['b'] = "NULL";
isSet($myArray['a']); //Will return TRUE
isSet($myArray['b']); //Will return TRUE
isSet($myArray['c']); //Will return FALSE

$_POST will *NOT* contain a value of NULL type. It's not possible.
It's unheard of. It's heresey.

On a side not, before parsing my arrays in code I always go through
and remove null values because they foul up iteration. The point is
you will not have NULL in this situation, nor will you ever care about
NULL values in an array.
On 11/8/05, Ben Ramsey <ramsey@xxxxxxx> wrote:
> On 11/8/05 11:52 PM, Ben Ramsey wrote:
> > I know this is off-topic for this thread, but just as I see isset()
> > misused (as in this case), I often see empty() misused. For example,
> > when using empty(), the following all return TRUE:
>
> On second thought, "misused" is the wrong word. I mean "misunderstood."
>
> --
> Ben Ramsey
> http://benramsey.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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