PHP Doku:: Returns the current element - simplexmliterator.current.html

Verlauf / Chronik / History: (1) anzeigen

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

Ein Service von Reinhard Neidl - Webprogrammierung.

The SimpleXMLIterator class

<<The SimpleXMLIterator class

SimpleXMLIterator::getChildren>>

SimpleXMLIterator::current

(PHP 5 >= 5.1.0)

SimpleXMLIterator::currentReturns the current element

Beschreibung

public mixed SimpleXMLIterator::current ( void )

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 folgende Ausgabe:

NULL
object(SimpleXMLIterator)#2 (1) {
  [0]=>
  string(10) "PHP basics"
}

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