ArrayIterator::next
PHP function
Edit on GitHub ✎
(PHP 5, PHP 7, PHP 8)
Move to next entry
Description
ArrayIterator::next(): void
Moves the iterator to the next entry.
Parameters Parameters
Return Values
Void
Examples
ArrayIterator::next() example
php
<?php
$arrayobject = new ArrayObject();
$arrayobject[] = 'zero';
$arrayobject[] = 'one';
$iterator = $arrayobject->getIterator();
while($iterator->valid()) {
echo $iterator->key() . ' => ' . $iterator->current() . "\n";
$iterator->next();
}
?>The above example will output:
output
0 => zero
1 => one