PHP next() Function
Example
Rewind to the first element, move to the next element and then return it with the current() function:
<?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());
?>
Run Example »
Definition and Usage
The next() function moves to the next element.
Syntax
SimpleXMLIterator::next()
Technical Details
Return Value: | Nothing |
---|---|
PHP Version: | 5.0+ |
❮ PHP SimpleXML Reference