Función PHP actual ()
Ejemplo
Rebobina hasta el primer elemento y luego devuélvelo con la función actual():
<?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());
?>
Definición y uso
La función current() devuelve el elemento actual.
Sintaxis
SimpleXMLIterator::current()
Detalles técnicos
Valor devuelto: | El elemento actual (como un objeto SimpleXMLIterator) en caso de éxito. NULL en caso de error |
---|---|
Versión PHP: | 5.0+ |
❮ Referencia PHP SimpleXML