SimpleXML is a PHP extension that allows us to easily manipulate and get XML data.
PHP SimpleXML – Get Node Values
Get the node values from the “note.xml” file:
Example
<?php $xml=simplexml_load_file("note.xml") or die("Error: Cannot create object"); echo $xml->to . "<br>"; echo $xml->from . "<br>"; echo $xml->heading . "<br>"; echo $xml->body; ?>
The output of the code above will be :
Tove
Jani
Reminder
Don’t forget me this weekend!