Re: Mystery foreach error
[email protected] (Jim Giner)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 3/12/2013 3:45 PM, Angela Barone wrote:
> $zip_short = substr($zip, 0, 3);
> foreach ($states[$state] as &$zip_prefix) { // <-- line 377
> if ($zip_prefix == $zip_short) {
> break;
> } else {
> $match = 'no';
> }
> }
>
I see the & in the foreach. Since you are not modifying anything in the
array, why are you using that?
Also - I'm assuming that $states is a multi-dimensional array?