XML to HTML entities – Encoding XML document text for HTML

private function XMLtoHTMLEntities($string){
//get rid of any XML entity encoding that may have been applied (like in an RSS feed)
$unXMLEntify = str_replace ( array ( '&' , '"', ''' , '<' , '>'), ->
array ( '&', '"', "'", '<', '>') , $string );
return htmlentities($unXMLEntify);
}

Leave a Reply

Your email address will not be published. Required fields are marked *