PHP | CachingIterator next()函数
CachingIterator::next()函数是PHP中的一个内置函数,用于将迭代器向前移动。
句法:
void CachingIterator::next( void )
参数:此函数不接受任何参数。
返回值:此函数不返回任何值。
下面的程序说明了PHP中的 CachingIterator::next()函数:
方案一:
current() . " ";
$cachIt->next();
}
?>
输出:
G e s
方案二:
"Geeks",
"b" => "for",
"c" => "Geeks",
"d" => "Computer",
"e" => "Science",
"f" => "Portal"
);
// Create a new CachingIterator
$cachIt = new CachingIterator(
new ArrayIterator($arr),
CachingIterator::FULL_CACHE
);
foreach($cachIt as $key => $value) {
echo $key . " => " . $cachIt->current() . "\n";
$cachIt->next();
}
?>
输出:
a => Geeks
c => Geeks
e => Science
参考: https://www. PHP.net/manual/en/cachingiterator.next。 PHP