note 35599 added to function.each
| From: | mark at kennel17 dot co dot uk | Date: | Mon, 08 Sep 2003 01:54:29 +0000 |
| Subject: | note 35599 added to function.each | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55772@lists.php.net to get a copy of this message | ||
In response to wvdmark at computer dot org this is expected behaviour of the while statement. Any
function in the head of the loop will be evaluated on each iteration and therefore, in your example,
explode will always create the same new array. Your example should be rewritten:
$arr = explode(',',$data);
while (list($key,$value) = each($arr))
----
Manual Page -- http://www.php.net/manual/en/function.each.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35599
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35599&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35599&report=yes