【发布时间】:2013-07-11 01:39:48
【问题描述】:
试图编写一个函数来纠正一组字谜的大小写,但看不出如何更合乎逻辑地做到这一点..
我现在有这个
$str = str_ireplace(" worda ", " Worda ", $str);
$str = str_ireplace(" wordb ", " woRrdb ", $str);
等等,一长串!
有没有办法让一组字符串替换为一组替换项?又名:
worda = Worda
wordb = woRdb
我也看到了使用 preg_replace 的其他示例,但也看不到使用该函数的方法。
【问题讨论】:
标签: php string replace preg-replace str-replace