$needle = array("Arr","Arr:","Arrang");
$haystack = " Arr is the proper way of Arr.";
echo str_replace($needle, "Arrangement", $haystack);
打印:Arrangement is the proper way of Arrangement
字符串替換第一個出現僅與字從一個數組在PHP
想要:Arrangement is the proper way of Arr.
這甚至顯示'Arrangementement是你如何Arrangementement' –
的正確方法選擇要替換的單詞? –