InfiniteIterator::__construct

(PHP 5 >= 5.1.0, PHP 7)

InfiniteIterator::__constructConstructs an InfiniteIterator

설명

public InfiniteIterator::__construct ( Iterator $iterator )

Constructs an InfiniteIterator from an Iterator.

인수

iterator

The iterator to infinitely iterate over.

반환값

값을 반환하지 않습니다.

오류/예외

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

예제

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

위 예제의 출력:

cat
dog
cat
dog
cat
dog
cat

참고

add a note add a note

User Contributed Notes

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