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/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php