note 109588 added to class.iterator
| From: | bournesabre86 at gmail dot com | Date: | Tue, 31 Jul 2012 04:05:49 +0000 |
| Subject: | note 109588 added to class.iterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189524@lists.php.net to get a copy of this message | ||
some revision with the example above.
it works better.
<?php
class SomeIterator implements Iterator {/*...implement...*/}
$it=new SomeIterator();
foreach($it as $key => $val) {
print "{$key}=>{$val}\n";
}
//just change the sequence of the process
$it=new SomeIterator();
for(
$it->rewind(), $val=$it->current(), $key=$it->key();
$it->valid();
$it->next()
) {
print "{$key}=>{$val}\n";
}
hope it makes the example clear.
----
Server IP: 69.147.83.197
Probable Submitter: 111.207.228.98
----
Manual Page -- http://www.php.net/manual/en/class.iterator.php
Edit -- https://master.php.net/note/edit/109588
Del: integrated -- https://master.php.net/note/delete/109588/integrated
Del: useless -- https://master.php.net/note/delete/109588/useless
Del: bad code -- https://master.php.net/note/delete/109588/bad+code
Del: spam -- https://master.php.net/note/delete/109588/spam
Del: non-english -- https://master.php.net/note/delete/109588/non-english
Del: in docs -- https://master.php.net/note/delete/109588/in+docs
Del: other reasons-- https://master.php.net/note/delete/109588
Reject -- https://master.php.net/note/reject/109588
Search -- https://master.php.net/manage/user-notes.php