note 109588 deleted from class.iterator by salathe
| From: | salathe@php.net | Date: | Tue, 31 Jul 2012 08:09:23 +0000 |
| Subject: | note 109588 deleted from class.iterator by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189525@lists.php.net to get a copy of this message | ||
Note Submitter: bournesabre86 at gmail dot com
----
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.