Ultimate PHP Escape String
Handy to have, taken from fooBar CMS.
if(!function_exists(‘escapeString’)) {
function escapeString($str){
$str = str_replace(array(‘\\’, “‘”), array(“\\\\”, “\\’”), $str);
$str = preg_replace(‘#([\x00-\x1F])#e’, ‘”\x” . sprintf(“%02x”, ord(“\1″))’, $str);
return $str;
}
}