- simplexml_load_string: documentation ( source)
- libxml_use_internal_errors: documentation ( source)
<?php
try {
libxml_use_internal_errors(true);
$xml = simplexml_load_string('<?xml version="1.0"?><Pablo is="gay></Pablo>');
libxml_use_internal_errors(false);
} catch (\Exception $e) {
echo $e->getMessage();
}