Re: [PHP] Mystery foreach error
[email protected] (Matijn Woudt)
| Newsgroups | php.general |
|---|---|
| Message-ID | <CAC_gtuO0HhvPE0Rz82CW5e8euqdyF1VYkh5W+4OUBNnfdXeogA@mail.gmail.com> |
On Thu, Mar 14, 2013 at 12:18 AM, Angela Barone <[email protected] > wrote: > On Mar 13, 2013, at 9:07 AM, Jim Giner wrote: > > Why not just check if the $state exists as a key of the array $states > before doing this? > > Jim, > > Are you thinking about the in_array function? > > Angela That wouldn't work, in_array checks the values, and your states are in the keys. Use: if(isset($states[$state])) - Matijn