note 59983 deleted from control-structures.foreach by felipe
| From: | felipe@php.net | Date: | Sun, 09 Dec 2007 16:03:29 +0000 |
| Subject: | note 59983 deleted from control-structures.foreach by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133043@lists.php.net to get a copy of this message | ||
Note Submitter: FatalError
----
I recommend using a "while" instead of a "foreach," like this:
<?php
while (list($key, $val) = each($array)) {
// Do something...
}
?>
This gives you more control and gets rid of some problems that you may have with the foreach
statement.