simplexml_import_dom()

It returns SimpleXMLElement object from a DOM node

Example

<?php
$dom = new domDocument;
$dom->loadXML(‘<web><server>Apache</server></web>’);
$xml = simplexml_import_dom($dom);
echo $xml->server;
?>

Output

Apache

Share