SeekableIterator::seek

Seeks to a position

&reftitle.description; public `void` `SeekableIterator::seek` `int` `offset`

Seeks to a given position in the iterator.

&reftitle.parameters;

`offset`

- The position to seek to.

&reftitle.returnvalues;

&return.void;

&reftitle.errors;

Implementations should throw an `OutOfBoundsException` if the `offset` is not seekable.

&reftitle.examples;

### `SeekableIterator::seek` example

Seek to the item at position 3 in the iterator (`ArrayIterator` implements `SeekableIterator`).

    <?php
    $array = array("apple", "banana", "cherry", "damson", "elderberry");
    $iterator = new ArrayIterator($array);
    $iterator->seek(3);
    echo $iterator->current();
    ?>

&example.outputs.similar;

    damson

&reftitle.seealso;

- `SeekableIterator`
- `Iterator`