simplexml_load_string()

It returns  SimpleXMLElement object from an XML string

Example

<?php
$xmlstring = ‘<?xml version=”1.0″ encoding=”ISO-8859-1″?><lan>PHP</lan>’;
$xml = simplexml_load_string($xmlstring);
print_r($xml);
?>

Output

SimpleXMLElement Object ( [0] => PHP )

Share