Source Code:
(back to article)
<?php $xml_string = "<root><element>text</element></root>"; $xml = simplexml_load_string($xml_string); if ($xml === false) { // Invalid XML print "Invalid XML"; } else { // Valid XML print "Valid XML"; }
Result:
Report an issue