PHP Doku:: Returns if the current iterator entry is valid - splobjectstorage.valid.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)DatenstrukturenThe SplObjectStorage classSplObjectStorage::valid

Ein Service von Reinhard Neidl - Webprogrammierung.

The SplObjectStorage class

<<SplObjectStorage::unserialize

Iteratoren>>

SplObjectStorage::valid

(PHP 5 >= 5.1.0)

SplObjectStorage::validReturns if the current iterator entry is valid

Beschreibung

public boolean SplObjectStorage::valid ( void )

Returns if the current iterator entry is valid.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Returns TRUE if the iterator entry is valid, FALSE otherwise.

Beispiele

Beispiel #1 SplObjectStorage::valid() example

<?php
$s 
= new SplObjectStorage();

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

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

$s->rewind();
while(
$s->valid()) {
    echo 
$s->key()."\n";
    
$s->next();
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

0
1

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