You are here: Re: [PHP] Type of form element « PHP « IT news, forums, messages
Re: [PHP] Type of form element

Posted by Jake Gardner on 10/13/26 11:31

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@php.net> 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
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация