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
1
2
3
4
5
6
<?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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.