PHP Doku:: Rewind the iterator to the first storage element - splobjectstorage.rewind.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-Startseite ≥ PHP-Handbuch ≥ Funktionsreferenz ≥ Sonstige Grunderweiterungen ≥ Standard PHP Library (SPL) ≥ Datenstrukturen ≥ The SplObjectStorage class ≥ SplObjectStorage::rewind

Ein Service von Reinhard Neidl - Webprogrammierung.

The SplObjectStorage class

<<SplObjectStorage::removeAllExcept

SplObjectStorage::serialize>>

SplObjectStorage::rewind

(PHP 5 >= 5.1.0)

SplObjectStorage::rewind — Rewind the iterator to the first storage element

Beschreibung

public void SplObjectStorage::rewind ( void )

Rewind the iterator to the first storage element.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #1 SplObjectStorage::rewind() example

<?php
$s 
= new SplObjectStorage();

$o1 = new StdClass;
$o2 = new StdClass;

$s->attach($o1, "d1");
$s->attach($o2, "d2");

$s->rewind();
while(
$s->valid()) {
    
$index  = $s->key();
    
$object = $s->current(); // similar to current($s)
    
$data   = $s->getInfo();

    
var_dump($object);
    
var_dump($data);
    
$s->next();
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

int(1)
int(0)

Siehe auch


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",...)