SimpleXMLIterator::rewind

(PHP 5 >= 5.1.0, PHP 7)
Rewind to the first element
public void SimpleXMLIterator::rewind ( void )

This method rewinds the SimpleXMLIterator to the first element.

Returns:

No value is returned.

Examples:
Rewind to the first element
<?php
$xmlIterator = new SimpleXMLIterator('<books><book>PHP Basics</book><book>XML Basics</book></books>');
$xmlIterator->rewind();

var_dump($xmlIterator->current());
?>

The above example will output:

object(SimpleXMLIterator)#2 (1) {
  [0]=>
  string(10) "PHP Basics"
}
doc_php
2016-02-24 16:15:16
Comments
Leave a Comment

Please login to continue.