<?php
$str = "I require that ċ is converted c ,ġ is converted g ,ħ is converted h ,ż is converted z";
function _search_replace ($s) {
$search_for = array('/ċ/', '/ġ/', '/ħ/', '/ż/');
$replace_with = array('c', 'g', 'h', 'z');
return preg_replace($search_for, $replace_with, $s);
}
print _search_replace($str);
将输出:
I require that c is converted c ,g is converted g ,h is converted h ,z is converted z
1条答案
按热度按时间vcudknz31#
可以使用preg\u replace一次替换多个字符:
将输出: