array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'simplexmlelement.rewind.php', 1 => 'SimpleXMLElement::rewind', 2 => 'Rewind to the first element', ), 'up' => array ( 0 => 'class.simplexmlelement.php', 1 => 'SimpleXMLElement', ), 'prev' => array ( 0 => 'simplexmlelement.registerxpathnamespace.php', 1 => 'SimpleXMLElement::registerXPathNamespace', ), 'next' => array ( 0 => 'simplexmlelement.savexml.php', 1 => 'SimpleXMLElement::saveXML', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/simplexml/simplexmlelement/rewind.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 8)
SimpleXMLElement::rewind — Rewind to the first element
Prior to PHP 8.0, SimpleXMLElement::rewind() was only declared on the subclass SimpleXMLIterator.
This method rewinds the SimpleXMLElement to the first element.
此函数没有参数。
没有返回值。
示例 #1 Rewind to the first element
<?php
$xmlElement = new SimpleXMLElement('<books><book>PHP Basics</book><book>XML Basics</book></books>');
$xmlElement->rewind();
var_dump($xmlElement->current());
?>以上示例会输出:
object(SimpleXMLElement)#2 (1) {
  [0]=>
  string(10) "PHP Basics"
}