InfiniteIterator
InfiniteIterator::next
InfiniteIterator
PHP Manual

# InfiniteIterator::__construct

(PHP 5 >= 5.1.0)

InfiniteIterator::__construct — Constructs an InfiniteIterator

### Descrição

public InfiniteIterator::__construct ( Iterator `$iterator` )

Constructs an InfiniteIterator from an Iterator.

### Parâmetros

`iterator`

  The iterator to infinitely iterate over.

### Valor Retornado

Não há valor retornado.

### Erros

Throws an `E_RECOVERABLE_ERROR` if the `iterator` parameter is not an Iterator.

### Exemplos

Exemplo #1 InfiniteIterator::__construct() example

`<?php
$arrayit = new ArrayIterator(array('cat','dog'));
$infinite = new InfiniteIterator($arrayit);
$limit = new LimitIterator($infinite, 0, 7);
foreach($limit as $value)
{
echo "$value\n";
}
?>`

O exemplo acima irá imprimir:

    cat
    dog
    cat
    dog
    cat
    dog
    cat

### Veja Também

- InfiniteIterator::next() - Moves the inner Iterator forward or rewinds it

InfiniteIterator
InfiniteIterator::next
InfiniteIterator
PHP Manual