mirror of
https://github.com/php/php-src.git
synced 2024-11-26 03:16:33 +08:00
52 lines
872 B
PHP
Executable File
52 lines
872 B
PHP
Executable File
--TEST--
|
|
SPL: InfiniteIterator
|
|
--FILE--
|
|
<?php
|
|
|
|
echo "===EmptyIterator===\n";
|
|
|
|
foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val)
|
|
{
|
|
echo "$key=>$val\n";
|
|
}
|
|
|
|
echo "===InfiniteIterator===\n";
|
|
|
|
$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
|
|
$it = new InfiniteIterator($it);
|
|
$it = new LimitIterator($it, 2, 5);
|
|
foreach($it as $val=>$key)
|
|
{
|
|
echo "$val=>$key\n";
|
|
}
|
|
|
|
echo "===Infinite/LimitIterator===\n";
|
|
|
|
$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
|
|
$it = new LimitIterator($it, 1, 2);
|
|
$it = new InfiniteIterator($it);
|
|
$it = new LimitIterator($it, 2, 5);
|
|
foreach($it as $val=>$key)
|
|
{
|
|
echo "$val=>$key\n";
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
===EmptyIterator===
|
|
===InfiniteIterator===
|
|
2=>C
|
|
3=>D
|
|
0=>A
|
|
1=>B
|
|
2=>C
|
|
===Infinite/LimitIterator===
|
|
1=>B
|
|
2=>C
|
|
1=>B
|
|
2=>C
|
|
1=>B
|
|
===DONE===
|