Re: note 8342 added to each
| From: | Rasmus Lerdorf | Date: | Thu, 07 Sep 2000 04:02:31 +0000 |
| Subject: | Re: note 8342 added to each | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-4290@lists.php.net to get a copy of this message | ||
You need to reset($array1) between the two loops.
On 7 Sep 2000 gateschris@yahoo.com wrote:
> as royapav@millsaps.edu 24-May-1999 10:02 mentions:
>
> the following code demonstrates the problem addressed by royapav:
>
> <HTML><?PHP
>
> $array1 = array ("hasdfkjl", "jdafkjalsd", "sadfjka;lk",
> "1", "2");
>
> while (list($key, $val) = each($array1))
> {
> print "first loop hi!\n";
> }
>
> print $array1[0];
>
> while (list($key, $val) = each($array1))
> {
> print "second loop hi!\n";
> }
> ?></HTML>
>
> This piece of code only prints the first loop in php version 3
>
> http://www.php.net/manual/function.each.php
>
>
>