In this below code, it will print all of the item of a xml file or string. But what if, i want not to print specific item? Suppose, i don't want to print the first item,then what can i do?
<!DOCTYPE html> <html> <body> <?php $note=<<<XML <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> XML; $xml=simplexml_load_string($note); echo $xml->getName() . "<br>"; foreach($xml->children() as $child) { echo $child->getName() . ": " . $child . "<br>"; } ?> </body> </html>
No comments:
Post a Comment