PHP ปัจจุบัน ()ฟังก์ชั่น
ตัวอย่าง
ย้อนกลับไปยังองค์ประกอบแรกแล้วส่งคืนด้วยฟังก์ชัน 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());
?>
ความหมายและการใช้งาน
ฟังก์ชัน current() คืนค่าองค์ประกอบปัจจุบัน
ไวยากรณ์
SimpleXMLIterator::current()
รายละเอียดทางเทคนิค
คืนมูลค่า: | องค์ประกอบปัจจุบัน (เป็นวัตถุ SimpleXMLIterator) เมื่อประสบความสำเร็จ NULL กับความล้มเหลว |
---|---|
รุ่น PHP: | 5.0+ |
❮ การอ้างอิง PHP SimpleXML