src/StreamIterator.php
public function seek($offset, $whence = SEEK_SET)
    {
        if (!is_int($offset) && !is_numeric($offset)) {
            return false;
        }

        $offset = (int) $offset;
        if ($offset < 0) {
            return false;
        }

        $key = $this->iterator->key();
        if (!is_int($key) && !is_numeric($key)) {
            $key = 0;
            $this->iterator->rewind();
        }

        if ($key >= $offset) {
            $key = 0;
            $this->iterator->rewind();
        }

        while ($this->iterator->valid() && $key < $offset) {
            $this->iterator->next();
            ++$key;
        }

        $this->position = $key;

        return true;
    }
public function seek($offset, $whence = SEEK_SET)
    {
        if (!is_int($offset) && !is_numeric($offset)) {
            return false;
        }

        $offset = (int) $offset;
        if ($offset < 0) {
            return false;
        }

        $key = $this->iterator->key();
        if (!is_int($key) && !is_numeric($key)) {
            $key = 0;
            $this->iterator->rewind();
        }

        if ($key >= $offset) {
            $key = 0;
            $this->iterator->rewind();
        }

        while ($this->iterator->valid() && $key < $offset) {
            $this->iterator->next();
            ++$key;
        }

        $this->position = $key;

        return true;
    }
public function seek ( $ offset , $ whence = SEEK_SET ) { if ( ! is_int ( $ offset ) && ! is_numeric ( $ offset ) ) { return false ; } $ offset = ( int ) $ offset ; if ( $ offset < 0 ) { return false ; } $ key = $ this -> iterator -> key ( ) ; if ( ! is_int ( $ key ) && ! is_numeric ( $ key ) ) { $ key = 0 ; $ this -> iterator -> rewind ( ) ; } if ( $ key >= $ offset ) { $ key = 0 ; $ this -> iterator -> rewind ( ) ; } while ( $ this -> iterator -> valid ( ) && $ key < $ offset ) { $ this -> iterator -> next ( ) ; ++ $ key ; } $ this -> position = $ key ; return true ; }
Seek the iterator.

@param int $offset Stream offset
@param int $whence ignored

@return bool returns TRUE on success or FALSE on failure
Seek the iterator .