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