note 48129 deleted from language.oop5.iterations by felipe
| From: | felipe@php.net | Date: | Mon, 24 Mar 2008 23:25:42 +0000 |
| Subject: | note 48129 deleted from language.oop5.iterations by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137532@lists.php.net to get a copy of this message | ||
Note Submitter: php at moechofe dot com
----
<?php
class MyIterator implements Iterator {
private $var = array();
public function __construct() {
$this->var = array( 1,2,3,4 ); }
public function rewind() { reset($this->var); }
public function current() { return current($this->var); }
public function key() { return key($this->var); }
public function next() { return next($this->var); }
public function valid() { return $this->current() !== false; }
}
$it = new MyIterator();
// dont work :(
echo $it[0];
?>