note 45425 added to language.oop5.iterations
| From: | B dot J dot Scharp at osu1 dot php dot net | Date: | Mon, 06 Sep 2004 22:18:29 +0000 |
| Subject: | note 45425 added to language.oop5.iterations | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76116@lists.php.net to get a copy of this message | ||
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);
}
?>
----
Manual Page -- http://www.php.net/manual/en/language.oop5.iterations.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45425
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45425&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45425&report=yes
Search -- http://master.php.net/manage/user-notes.php