note 90572 deleted from class.iterator by danbrown
| From: | danbrown@php.net | Date: | Tue, 28 Apr 2009 21:16:57 +0000 |
| Subject: | note 90572 deleted from class.iterator by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153950@lists.php.net to get a copy of this message | ||
Note Submitter: werner at procurios dot nl
Reason: bad code
----
The example for() loops below are incorrect.
If you want to emulate a foreach() loop with a for loop it should be writtin as:
<php?
for ($I->rewind(); $I->valid(); $I->next()) {
$value = $I->current();
$key = $I->key();
}
?>
This way it correctly matches the function call order that a foreach() loop does.