3v4l.org

run code in 200+ PHP versions simultaneously
<?php $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <root> <item> <foo id=\"1\"><![CDATA[123]]></foo> <bar><![CDATA[abc]]></bar> </item> <item> <foo id=\"1\">123</foo> <bar>abc</bar> </item> </root>"; $sxml = simplexml_load_string($xml, null, LIBXML_NOCDATA); print_r($sxml); print_r($sxml->item[0]->foo["id"]);