PHP Doku:: Check whether the current element is valid - simplexmliterator.valid.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)IteratorenThe SimpleXMLIterator classSimpleXMLIterator::valid

Ein Service von Reinhard Neidl - Webprogrammierung.

The SimpleXMLIterator class

<<SimpleXMLIterator::rewind

Interfaces>>

SimpleXMLIterator::valid

(PHP 5 >= 5.1.0)

SimpleXMLIterator::validCheck whether the current element is valid

Beschreibung

bool SimpleXMLIterator::valid ( void )

This method checks if the current element is valid after calls to SimpleXMLIterator::rewind() or SimpleXMLIterator::next().

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

Returns TRUE if the current element is valid, otherwise FALSE

Beispiele

Beispiel #1 Check whether the current element is valid

<?php
$xmlIterator 
= new SimpleXMLIterator('<books><book>SQL Basics</book></books>');

$xmlIterator->rewind(); // rewind to the first element
echo var_dump($xmlIterator->valid()); // bool(true)

$xmlIterator->next(); // advance to the next element
echo var_dump($xmlIterator->valid()); // bool(false) because there is only one element
?>


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