note 9448 added to foreach
| From: | orque at mac dot com | Date: | Fri, 03 Nov 2000 17:32:53 +0000 |
| Subject: | note 9448 added to foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7346@lists.php.net to get a copy of this message | ||
In addition to my note above, I've found the best solution is to "for" over your
array and copy it into a new one to use (copying the values into the same array results in the same
wackiness). I mention this because if you use several of the other php functions including
array_slice, array_splice, array_merge they will put your array permanently in the "order of
creation" state and you can't loop correctly through it with a for loop. Hope this helps.
http://www.php.net/manual/control-structures.foreach.php