ArrayIterator::next
PHP Manual
PHP Manual»ArrayIterator»ArrayIterator::next

ArrayIterator::next

(PHP 5, PHP 7, PHP 8)

ArrayIterator::nextMove to next entry

Descrizione

public function ArrayIterator::next(): void

Moves the iterator to the next entry.

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

Nessun valore viene restituito.

Esempi

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();
}
?>

Il precedente esempio visualizzerà:

0 => zero
1 => one

To Top