PHP next() 函式
示例
將指標移到下一個元素,然後使用 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);
// 回到第一個元素
$xml->rewind();
// 移動到下一個元素
$xml->next();
// 返回當前元素
var_dump($xml->current());
?>
執行示例 »
定義和用法
next() 函式將指標移到下一個元素。
語法
SimpleXMLIterator::next()
技術詳情
返回值 | 無 |
---|---|
PHP 版本 | 5.0+ |
❮ PHP SimpleXML 參考