Reply to Re: [PHP] Type of form element

Your name:

Reply:


Posted by Chris Shiflett on 11/01/05 02:15

Marcus Bointon wrote:
> Given $myarray['a'] = NULL, isset($myarray[a']) returns false.

Yes, I think we've established that.

I'm sure Richard and I were both well aware of this fact, but just in
case we weren't, I think we can safely assume we are by now. :-)

> You're saying that therefore, $myarray['a'] does not exist

Well, I have the same opinion that isset() does - if a variable is set
to NULL, it may as well not be set. I understand and appreciate the way
PHP works and frequently rely upon its friendly behavior. If I really
care to know whether something is NULL (which I rarely do), I can always
use is_null(). Of course, none of this applies to the present topic,
because NULL is not a string.

In previous replies, I've provided methods that you can use to
distinguish between NULL, the empty string, 0, etc. There's also a table
at the top of this cheat sheet that you might find helpful:

http://www.blueshoes.org/en/developer/php_cheat_sheet

(Notice that is_null() and isset() are boolean opposites.)

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

[Back to original 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

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