phpday 2027 - Call for Papers

InfiniteIterator::__construct

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

InfiniteIterator::__construct — Construye un InfiniteIterator

Descripción

public function InfiniteIterator::__construct(Iterator $iterator)

Construye un InfiniteIterator de un Iterator.

Parámetros

iterator

El iterador a iterar infinitamente.

Ejemplos

Ejemplo #1 Ejemplo de InfiniteIterator::__construct()

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

El ejemplo anterior mostrará:

gato
perro
gato
perro
gato
perro
gato

Véase también

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top