當我運行,通過該功能,它與QUOT更換引號包含雙引號短語刪除單引號和雙引號。如何從一個字符串
我要徹底刪除它們(也單引號)。我如何改變功能來做到這一點?
function string_sanitize($s) {
$result = preg_replace("/[^a-zA-Z0-9]+/", "", $s);
return $result;
}
更新:
Example 1: This is 'the' first example
returns: Thisis030the039firstexample
Errors: Warning: preg_match_all() [function.preg-match-all]: Unknown modifier '0' in C
Example 2: This is my "second" example
returns: Thisismyquotsecondquotexample
Errors: Invalid express in Xpath
此功能已經削減了兩個'''和'「' – zerkms 2011-03-28 03:14:53