array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'arrayiterator.current.php', 1 => 'ArrayIterator::current', ), 'up' => array ( 0 => 'class.arrayiterator.php', 1 => 'ArrayIterator', ), 'prev' => array ( 0 => 'arrayiterator.count.php', 1 => 'ArrayIterator::count', ), 'next' => array ( 0 => 'arrayiterator.getarraycopy.php', 1 => 'ArrayIterator::getArrayCopy', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'fr', 'path' => 'reference/spl/arrayiterator/current.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
ArrayIterator::current — Retourne l'entrée courante du tableau
Cette fonction ne contient aucun paramètre.
L'entrée courante du tableau.
Exemple #1 Exemple avec ArrayIterator::current()
<?php
$array = array('1' => 'one',
'2' => 'two',
'3' => 'three');
$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 => one 2 => two 3 => three