Php/docs/arrayiterator.next

来自菜鸟教程
跳转至:导航、​搜索

ArrayIterator::next

(PHP 5, PHP 7)

ArrayIterator::nextMove to next entry


说明

public ArrayIterator::next ( ) : void

The iterator to the next entry.


参数

此函数没有参数。


返回值

没有返回值。


范例

Example #1 ArrayIterator::next() example

<?php$arrayobject = new ArrayObject();$arrayobject[] = 'zero';$arrayobject[] = 'one';$iterator = $arrayobject->getIterator();while($iterator->valid()) {    echo $iterator->key() . ' => ' . $iterator->current() . "\n";    $iterator->next();}?>

以上例程会输出:


0 => zero
1 => one