Função PHP next()
Exemplo
Rebobine para o primeiro elemento, mova para o próximo elemento e 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();
// move to the next element
$xml->next();
//
return current element
var_dump($xml->current());
?>
Definição e uso
A função next() move para o próximo elemento.
Sintaxe
SimpleXMLIterator::next()
Detalhes técnicos
Valor de retorno: | Nenhuma coisa |
---|---|
Versão do PHP: | 5.0+ |
❮ Referência PHP SimpleXML