Re: Mystery foreach error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 14, 2013 at 12:18 AM, Angela Barone <angela@xxxxxxxxxxxxxxxxxxxx
> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux