public static function StripHiddenChars($str) { $chars = array("\r\n", "\n", "\r", "\t", "\x00", "\v", "\xef", "\xbb", "\xbf"); $str = str_replace($chars, " ", $str); return preg_replace('/\\s+/', ' ', $str); }