_from = $from; $this->_to = $to; $this->_step = $step; return; } /** * Return the current element. * * @return int */ public function current() { return $this->_i; } /** * Return the key of the current element. * * @return int */ public function key() { return $this->_key; } /** * Move forward to next element. * * @return void */ public function next() { ++$this->_key; $this->_i += $this->_step; return; } /** * Rewind the iterator to the first element. * * @return void */ public function rewind() { $this->_key = 0; $this->_i = $this->_from; return; } /** * Check if current position is valid. * * @return bool */ public function valid() { return $this->_i < $this->_to; } }