note 90820 added to class.iterator
| From: | werner at procurios dot nl | Date: | Mon, 11 May 2009 18:39:10 +0000 |
| Subject: | note 90820 added to class.iterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154464@lists.php.net to get a copy of this message | ||
The for() loops in the post below aren't correct. They don't call the functions in the
exact same order as foreach() does.
If you want to emulate a foreach() loop using for() it should look like this:
<?php
for ($Iterator->rewind(); $Iterator->valid(); $Iterator->next()) {
$value = $Iterator->current();
$key = $Iterator->key();
}
?>
----
Server IP: 83.137.20.135
Probable Submitter: 80.126.100.119
----
Manual Page -- http://www.php.net/manual/en/class.iterator.php
Edit -- https://master.php.net/note/edit/90820
Del: integrated -- https://master.php.net/note/delete/90820/integrated
Del: useless -- https://master.php.net/note/delete/90820/useless
Del: bad code -- https://master.php.net/note/delete/90820/bad+code
Del: spam -- https://master.php.net/note/delete/90820/spam
Del: non-english -- https://master.php.net/note/delete/90820/non-english
Del: in docs -- https://master.php.net/note/delete/90820/in+docs
Del: other reasons-- https://master.php.net/note/delete/90820
Reject -- https://master.php.net/note/reject/90820
Search -- https://master.php.net/manage/user-notes.php