ArrayIterator::current
(PHP 5)
ArrayIterator::current — Retourne l'entrée courante du tableau
Description
mixed ArrayIterator::current
( void
)
ArrayIterator::current() retourne l'entrée courante du tableau.
Example#1 Exemple avec ArrayIterator::current()
<?php
$array = array('1' => 'un',
'2' => 'deux',
'3' => 'trois');
$arrayobject = new ArrayObject($array);
for($iterator = $arrayobject->getIterator();
$iterator->valid();
$iterator->next()) {
echo $iterator->key() . ' => ' . $iterator->current() . "\n";
}
?>
L'exemple ci-dessus va afficher :
1 => un 2 => deux 3 => trois