【发布时间】:2014-07-08 13:22:57
【问题描述】:
如何从每个单词的某个位置开始替换字符串中每个单词的字符?
例如:
$string = "one twone trone fourone nourone";<br />
// I want to replace each n with X starting from second position in each word.<br />
// Last word has n on first position and should remain there.<br />
$new_string = "oXe twoXe troXe fouroXe nouroXe";
【问题讨论】:
-
可以查看
str_replace、str_ireplace、preg_replace的使用情况。
标签: php string replace word each