InfiniteIterator::__construct

(PHP 5 >= 5.1.0, PHP 7)

InfiniteIterator::__constructConstructs an InfiniteIterator

Descrizione

public InfiniteIterator::__construct ( Iterator $iterator )

Constructs an InfiniteIterator from an Iterator.

Elenco dei parametri

iterator

The iterator to infinitely iterate over.

Valori restituiti

Nessun valore viene restituito.

Errori/Eccezioni

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

Esempi

Example #1 InfiniteIterator::__construct() example

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

Il precedente esempio visualizzerĂ :

cat
dog
cat
dog
cat
dog
cat

Vedere anche:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top