InfiniteIterator::__construct
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
InfiniteIterator::__construct — Constructs an InfiniteIterator
说明
Constructs an InfiniteIterator from an Iterator.
参数
-
iterator
-
The iterator to infinitely iterate over.
范例
示例 #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";
}
?>
以上例程会输出:
cat dog cat dog cat dog cat

User Contributed Notes
There are no user contributed notes for this page.
备份地址:http://www.lvesu.com/blog/php/infiniteiterator.construct.php