CachingIterator::hasNext 示例
<?php
$ait = new ArrayIterator(array('Value 1', 'Value 2', 'Value 3', 'Value 4'));
$cit = new CachingIterator($ait);
foreach ($cit as $value) {
echo $value;
// 如果有下一个值,则打印逗号
if ($cit->hasNext()) {
echo ', ';
}
}
?>
结果:Value 1, Value 2, Value 3, Value 4