fp = $fp; $this->line = rtrim(fgets($this->fp), "\n"); } public function rewind() { $this->index = 0; rewind($this->fp); $this->line = rtrim(fgets($this->fp), "\n"); } public function next() { $this->index++; $this->line = rtrim(fgets($this->fp), "\n"); if (!feof($this->fp)) { return $this->line; } else { return null; } } public function key() { return $this->index; } public function current() { return $this->line; } public function valid() { return feof($this->fp) ? false : true; } }