0
假設我有這樣的功能:在PHP扭轉了正則表達式
function f($string){
$string = preg_replace("`\[.*\]`U","",$string);
$string = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$string);
$string = htmlentities($string, ENT_COMPAT, 'utf-8');
$string = preg_replace("`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $string);
$string = preg_replace(array("`[^a-z0-9]`i","`[-]+`") , "-", $string);
return $string;
}
我怎樣才能扭轉這種功能...即。我應該怎麼寫功能fReverse(),使得我們有以下幾點:
$s = f("some string223---");
$reversed = fReverse($s);
echo $s;
輸出:一些string223 ---
爲什麼不只是保存第一個字符串的地方? – 2011-04-02 18:18:31
這一點是這樣的,你可以動態地從url中反轉這些字符串,這樣就可以達到目的 – 2011-04-02 18:19:27