GoLang InfiniteIterator::__construct

request it (381)
GoLang replacement for PHP's InfiniteIterator::__construct [edit | history]



Do you know a GoLang replacement for PHP's InfiniteIterator::__construct? Write it!

PHP InfiniteIterator::__construct

PHP original manual for InfiniteIterator::__construct [ show | php.net ]

InfiniteIterator::__construct

(PHP 5 >= 5.1.0, PHP 7)

InfiniteIterator::__constructConstructs an InfiniteIterator

Description

public InfiniteIterator::__construct ( Iterator $iterator )

Constructs an InfiniteIterator from an Iterator.

Parameters

iterator

The iterator to infinitely iterate over.

Return Values

No value is returned.

Errors/Exceptions

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

Examples

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

The above example will output:

cat
dog
cat
dog
cat
dog
cat

See Also