note 39119 added to control-structures.foreach
| From: | Vincent at rn2 dot php dot net | Date: | Sat, 17 Jan 2004 17:55:35 +0000 |
| Subject: | note 39119 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63743@lists.php.net to get a copy of this message | ||
Note that these two pieces of code do exactly the same thing.
<?php
foreach ($array as $key => $val) {
// Do something with $array
}
?>
<?php
reset($array);
while (list($key,$val) = each($array)) {
// Do something with $array
}
?>
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39119
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39119&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39119&report=yes
Search -- http://master.php.net/manage/user-notes.php