PHP huidige() Functie
Voorbeeld
Spoel terug naar het eerste element en retourneer het vervolgens met de huidige () functie:
<?php
$note=<<<XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Do not forget me this weekend!</body>
</note>
XML;
$xml = new SimpleXMLIterator($note);
// rewind to the first element
$xml->rewind();
// return current element
var_dump($xml->current());
?>
Definitie en gebruik
De functie current() retourneert het huidige element.
Syntaxis
SimpleXMLIterator::current()
Technische details
Winstwaarde: | Het huidige element (als een SimpleXMLIterator-object) bij succes. NULL bij fout |
---|---|
PHP-versie: | 5.0+ |
❮ PHP SimpleXML-referentie