data = $data; } public function valid () { if ($this->row) return true; return false; } public function current () { return $this->row; } public function key () { return $this->key; } public function next () { $this->row = array_pop($this->data); $this->key++; } public function rewind () { $this->key = -1; $this->next(); } } $rows = new mIterator( array( 'One', 'Two', 'Three' ) ); foreach ($rows as $key => $value) { echo $key ."=". $value ."\n"; } ?>