Função PHP atual()
Exemplo
Rebobine para o primeiro elemento e depois retorne-o com a função current():
<?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());
?>
Definição e uso
A função current() retorna o elemento atual.
Sintaxe
SimpleXMLIterator::current()
Detalhes técnicos
Valor de retorno: | O elemento atual (como um objeto SimpleXMLIterator) em caso de sucesso. NULL em caso de falha |
---|---|
Versão do PHP: | 5.0+ |
❮ Referência PHP SimpleXML