array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'arrayiterator.rewind.php', 1 => 'ArrayIterator::rewind', 2 => 'Rewind array back to the start', ), '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' => 'en', 'path' => 'reference/spl/arrayiterator/rewind.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ArrayIterator::rewind

(PHP 5, PHP 7, PHP 8)

ArrayIterator::rewindRewind array back to the start

Опис

public ArrayIterator::rewind(): void

This rewinds the iterator to the beginning.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Не повертає значень.

Приклади

Приклад #1 ArrayIterator::rewind() example

<?php
$arrayobject
= new ArrayObject();

$arrayobject[] = 'zero';
$arrayobject[] = 'one';
$arrayobject[] = 'two';

$iterator = $arrayobject->getIterator();

$iterator->next();
echo
$iterator->key(); //1

$iterator->rewind(); //rewinding to the beginning
echo $iterator->key(); //0
?>