Re: problem with foreach
| From: | Nathan Hawks | Date: | Mon, 22 Oct 2007 19:14:55 +0000 |
| Subject: | Re: problem with foreach | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-263517@lists.php.net to get a copy of this message | ||
Also, AFAIK, PHP has always thrown a warning or notice if you use
foreach() on a non-associative array. That doesn't mean it won't work,
but the strict standard is apparently:
foreach ($assoc as $key => $val)
not
foreach ($indexed as $item)
However, as we all know, the latter still works fine.
Despite the warning/notice you see, the code is probably still working
as expected (any other problems aside). If you like to keep error
reporting on, you can just use an @ to suppress that error.