26 if ( !is_array($search) ) {
28 $slen = strlen($search);
33 $lendif = strlen($replace) - strlen($search);
36 $search = preg_quote($search,
'/');
40 while ( preg_match(
'/(.*)'.$search.
'/Us',$lstr, $matches) ) {
41 if ( $i === $count ) {
44 $mlen = strlen($matches[0]);
45 $lstr = substr($lstr, $mlen);
46 $str = substr_replace($str, $replace, $matched+strlen($matches[1]), $slen);
47 $matched += $mlen + $lendif;
54 foreach ( array_keys($search) as $k ) {
56 if ( is_array($replace) ) {
58 if ( array_key_exists($k,$replace) ) {
60 $str =
utf8_ireplace($search[$k], $replace[$k], $str, $count);