rewind()

创建于 2024-12-03 / 31
字体: [默认] [大] [更大]

❮ PHP SimpleXML 参考手册

实例

回退到第一个元素,然后返回它(使用 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());
?> 运行实例 »

定义和用法

rewind() 函数回退到第一个元素。


语法

SimpleXMLIterator::rewind()

技术细节

返回值: Nothing
PHP 版本: 5.0+

❮ PHP SimpleXML 参考手册
0 人点赞过