Re: Mystery foreach error
| From: | Angela Barone | Date: | Thu, 14 Mar 2013 00:39:41 +0000 |
| Subject: | Re: Mystery foreach error | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320532@lists.php.net to get a copy of this message | ||
On Mar 13, 2013, at 5:02 PM, David Harkness wrote:
> isset() will return false for an array key 'foo' mapped to a null value whereas
> array_key_exists() will return true. The latter asks "Is this key in the array?" whereas
> isset() adds "and is its value not null?" While isset() is every-so-slightly faster, this
> should not be a concern. Use whichever makes sense for the context here.
Hi David,
Thank you for the explanation. It's nice to know the difference between them. Since they are
equivalent for my use, I went with array_key_exists, simply because it makes more sense to me in
English. ;)
Thanks again to everyone. I got it to work _and_ there are no more errors!!!
Angela