PHP Doku:: Rewind array back to the start - arrayiterator.rewind.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)IteratorenThe ArrayIterator classArrayIterator::rewind

Ein Service von Reinhard Neidl - Webprogrammierung.

The ArrayIterator class

<<ArrayIterator::offsetUnset

ArrayIterator::seek>>

ArrayIterator::rewind

(PHP 5 >= 5.0.0)

ArrayIterator::rewindRewind array back to the start

Beschreibung

void ArrayIterator::rewind ( void )

This rewinds the iterator to the beginning.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #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 begining
echo $iterator->key(); //0
?>


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)