array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'arrayiterator.rewind.php', 1 => 'ArrayIterator::rewind', ), 'up' => array ( 0 => 'class.arrayiterator.php', 1 => 'ArrayIterator', ), 'prev' => array ( 0 => 'arrayiterator.offsetunset.php', 1 => 'ArrayIterator::offsetUnset', ), 'next' => array ( 0 => 'arrayiterator.seek.php', 1 => 'ArrayIterator::seek', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/spl/arrayiterator/rewind.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
ArrayIterator::rewind — Recoloca o array no início
Esta função não possui parâmetros.
Nenhum valor é retornado.
Exemplo #1 Exemplo de ArrayIterator::rewind()
<?php
$arrayobject = new ArrayObject();
$arrayobject[] = 'zero';
$arrayobject[] = 'um';
$arrayobject[] = 'dois';
$iterator = $arrayobject->getIterator();
$iterator->next();
echo $iterator->key(); //1
$iterator->rewind(); //retornando ao início
echo $iterator->key(); //0
?>