- simplexml_load_string: documentation ( source)
- header: documentation ( source)
<?php
header('Content-Type: text/plain');
$str_xml = "<myxml><mytag><![CDATA[In this content, 8 > 2 & 1 < 9, and 10 is a 10% of 100. ]]></mytag></myxml>";
try {
echo "XML with CDATA: \n\n";
$xml = simplexml_load_string($str_xml);
echo $xml->asXML() ."\n\n";
} catch(Exception $e){
echo "XML with CDATA: \n\n";
echo $e->getMessage() ."\n\n";
}