note 45425 deleted from language.oop5.iterations by nlopess
| From: | nlopess@php.net | Date: | Tue, 07 Sep 2004 09:12:54 +0000 |
| Subject: | note 45425 deleted from language.oop5.iterations by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76134@lists.php.net to get a copy of this message | ||
Note Submitter: B.J.Scharp
----
Note that many Iterators have already been defined in the Standard PHP Library, and can be used with
the IteratorAggregate interface.
For more info, see here: http://www.php.net/manual/en/ref.spl.php
The most catching of these is undoubtly the arrayIterator, which matches the MyIterator declared
above completely, except for the debug output.
The getIterator function in the second example above could thus be replaced by this one:
<?php
public function getIterator() {
return new arrayIterator($this->items);
}
?>