note 96073 added to language.oop5.iterations
| From: | uramihsayibok at osu1 dot php dot net | Date: | Sun, 07 Feb 2010 04:23:51 +0000 |
| Subject: | note 96073 added to language.oop5.iterations | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165720@lists.php.net to get a copy of this message | ||
With method names like "current", "key", and "next", one might think
that you can use the corresponding functions on your objects. For instance,
<?php
class MyIterator implements Iterator {
// as defined in example #2
}
$iterator = new MyIterator(array(1, 2, 3));
reset($iterator); // calls $iterator->rewind?
var_dump(current($iterator)); // calls $iterator->current()?
?>
This doesn't work. It has been reported as a bug (and honestly it *would* make sense) but was
rejected - objects can be treated as arrays... and that's what happens.
----
Server IP: 192.41.40.227
Probable Submitter: 69.166.47.131
----
Manual Page -- http://www.php.net/manual/en/language.oop5.iterations.php
Edit -- https://master.php.net/note/edit/96073
Del: integrated -- https://master.php.net/note/delete/96073/integrated
Del: useless -- https://master.php.net/note/delete/96073/useless
Del: bad code -- https://master.php.net/note/delete/96073/bad+code
Del: spam -- https://master.php.net/note/delete/96073/spam
Del: non-english -- https://master.php.net/note/delete/96073/non-english
Del: in docs -- https://master.php.net/note/delete/96073/in+docs
Del: other reasons-- https://master.php.net/note/delete/96073
Reject -- https://master.php.net/note/reject/96073
Search -- https://master.php.net/manage/user-notes.php