Re: Mystery foreach error
| From: | Matijn Woudt | Date: | Wed, 13 Mar 2013 23:24:02 +0000 |
| Subject: | Re: Mystery foreach error | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320525@lists.php.net to get a copy of this message | ||
On Thu, Mar 14, 2013 at 12:18 AM, Angela Barone <angela@italian-getaways.com
> 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