NoRewindIterator::__construct

Construct a NoRewindIterator

&reftitle.description; public `NoRewindIterator::__construct` `Iterator` `iterator`

Constructs a NoRewindIterator.

&reftitle.parameters;

`iterator`

- The iterator being used.

&reftitle.examples;

### `NoRewindIterator::__construct` example

The second loop does not output because the iterator is only used once, as it does not rewind.

    <?php
    $fruit = array('apple', 'banana', 'cranberry');

    $arr = new ArrayObject($fruit);
    $it  = new NoRewindIterator($arr->getIterator());

    echo "Fruit A:\n";
    foreach( $it as $item ) {
        echo $item . "\n";
    }

    echo "Fruit B:\n";
    foreach( $it as $item ) {
        echo $item . "\n";
    }
    ?>

&example.outputs.similar;

    Fruit A:
    apple
    banana
    cranberry
    Fruit B:

&reftitle.seealso;

- `NoRewindIterator::valid`