InfiniteIterator::__construct

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

InfiniteIterator::__constructConstructs an InfiniteIterator

Açıklama

public InfiniteIterator::__construct(Iterator $iterator)

Constructs an InfiniteIterator from an Iterator.

Bağımsız Değişkenler

iterator

The iterator to infinitely iterate over.

Örnekler

Örnek 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";
}
?>

Yukarıdaki örneğin çıktısı:

cat
dog
cat
dog
cat
dog
cat

Ayrıca Bakınız

add a note

User Contributed Notes

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant