2017-09-15 135 views
0

我得到錯誤機智preg替換。Preg替換etting錯誤

這裏是我的代碼

$search='+5DR'; 
$replace='5'; 
$tempString='1.2 EASY +5DR'; 
echo $tempString = preg_replace('~\b('. $search.')\b~', $replace, $tempString); 

錯誤詳細信息

<br /> 
<b>Warning</b>: preg_replace(): 
Compilation failed: nothing to repeat at 
offset 3 in <b>[...][...]</b> on line <b>6</b><br /> 
+0

你應該考慮,如果你需要檢查固定字符串使用'str_replace'。 –

回答