note 95940 added to function.current
| From: | adam dot zivner at gmail dot com | Date: | Fri, 29 Jan 2010 15:31:42 +0000 |
| Subject: | note 95940 added to function.current | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165494@lists.php.net to get a copy of this message | ||
Thanks Gregory for the solution for the Iterator problem ...
But wouldn't it be simpler if you'd just check key() in valid() method?
public function rewind() { reset($this->data); }
public function current() { return current($this->data); }
public function key() { return key($this->data); }
public function next() { next($this->data); }
public function valid() { return key($this->data) !== null; }
----
Server IP: 147.32.160.17
Probable Submitter: 83.208.59.118
----
Manual Page -- http://www.php.net/manual/en/function.current.php
Edit -- https://master.php.net/note/edit/95940
Del: integrated -- https://master.php.net/note/delete/95940/integrated
Del: useless -- https://master.php.net/note/delete/95940/useless
Del: bad code -- https://master.php.net/note/delete/95940/bad+code
Del: spam -- https://master.php.net/note/delete/95940/spam
Del: non-english -- https://master.php.net/note/delete/95940/non-english
Del: in docs -- https://master.php.net/note/delete/95940/in+docs
Del: other reasons-- https://master.php.net/note/delete/95940
Reject -- https://master.php.net/note/reject/95940
Search -- https://master.php.net/manage/user-notes.php