I\'m generating an XML document from a PHP script and I need to escape the XML special characters. I know the list of characters that should be escaped; but what is the corr
function replace_char($arr1) { $arr[]=preg_replace('>','>', $arr1); $arr[]=preg_replace('<','<', $arr1); $arr[]=preg_replace('"','"', $arr1); $arr[]=preg_replace('\'','&apos', $arr1); $arr[]=preg_replace('&','&', $arr1); return $arr; }