Hàm rewind () trong PHP
Thí dụ
Tua lại phần tử đầu tiên và sau đó trả lại nó (với 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());
?>
Định nghĩa và Cách sử dụng
Hàm rewind () tua đến phần tử đầu tiên.
Cú pháp
SimpleXMLIterator::rewind()
Chi tiết kỹ thuật
Giá trị trả lại: | Không |
---|---|
Phiên bản PHP: | 5.0+ |
❮ Tham chiếu PHP SimpleXML