Move to next entry with ArrayIterator::next in PHP
Description
The following code shows how to move to next entry with ArrayIterator::next.
Example
<?php//from w ww . ja va 2s .c o m
$arrayobject = new ArrayObject();
$arrayobject[] = 'zero';
$arrayobject[] = 'one';
$iterator = $arrayobject->getIterator();
while($iterator->valid()) {
echo $iterator->key() . ' => ' . $iterator->current() . "\n";
$iterator->next();
}
?>
The code above generates the following result.