PHP Dokumentation: Simplexmliterator current
12. Januar 2010 von werner
SimpleXMLIterator::current
(PHP 5 >= 5.1.0)
SimpleXMLIterator::current — Returns the current element
Beschreibung
This method returns the current element as a SimpleXMLIterator object or NULL.
Parameter-Liste
Diese Funktion hat keine Parameter.
Rückgabewerte
Returns the current element as a SimpleXMLIterator object or NULL on failure.
Beispiele
Beispiel #1 Return the current element
<?php
$xmlIterator = new SimpleXMLIterator('<books><book>PHP basics</book><book>XML basics</book></books>');
var_dump($xmlIterator->current());$xmlIterator->rewind(); // rewind to first element
var_dump($xmlIterator->current());
?>Das oben gezeigte Beispiel erzeugt folgendeAusgabe:
NULLobject(SimpleXMLIterator)#2 (1) { [0]=> string(10) "PHP basics"}