On Mon, October 31, 2005 4:56 pm, Marcus Bointon wrote: > Yesterday I encountered an error in a large commercial php script and > it turned out that it was looking in $_SERVER['SERVER_NAME'] which > was there but set to NULL for some reason, and their test with isset > was failing. So it's not just academic and I'm not making it up - > this problem does happen for real. So are you going to ignore the bug that put NULL into $_SERVER['SERVER_NAME']??? Cuz, really, not using isset() because somebody screwed up and put NULL into $_SERVER['SERVER_NAME'] is not my idea of good code. :-) PS I would never, ever, write: $myarray['a'] = NULL; if I wanted it to be unset. I'd write: unset($myarray['a']); And guess what? isset() works for that. If you want to stuff NULL into something, and then use is_null() that makes sense. If you want to stuff NULL in there, and then use isset(), I'm not quite sure why you'd put NULL in there in the first place, but I don't rightly know what I'd expect isset() to return. Same for $a or $myarray['a'] What's it supposed to MEAN in your code if you cram NULL into an array as a value? I guess I'm not seeing a useful reason to do that. Ever. [shrug] Maybe that's only cuz this whole NULL thing is just too new-fangled (in PHP) for an old dog like me. :-) I'd also be quite happy to have isset($myarray['a']) return TRUE if you've got NULL crammed in there. [shrug] I don't know what meaning one wants to assign to a NULL value crammed into an array as a value under a given index, but, as far as I'm concerned, NULL is a perfectly fine (if somewhat distinctive) value, and the array key is "set" to that weird-o value of NULL. I don't know (or really care) what this will output: <?php $myarray['a'] = NULL; echo isset($myarray['a']); ?> I ain't never gonna type it, so I don't care what it does. :-) And, yes, that would imply that: <?php $a = NULL; echo isset($a); ?> should behave the same. I dunno which way PHP-Dev fell on this one, but I'll be it was a long argument. :-) Probably even longer than this one :-) :-) :-) That said: I use isset() and I use unset() and if I had crammed NULL into my array in the first place, I reckon I'd use isnull() or whatever it is to test for NULL in there... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php