3 if(!function_exists('smarty_mb_str_replace')) {
4 function smarty_mb_str_replace($search, $replace, $subject, &$count=0) {
5 if (!is_array($search) && is_array($replace)) {
8 if (is_array($subject)) {
9 // call mb_replace for each single string in $subject
10 foreach ($subject as &$string) {
11 $string = &smarty_mb_str_replace($search, $replace, $string, $c);
14 } elseif (is_array($search)) {
15 if (!is_array($replace)) {
16 foreach ($search as &$string) {
17 $subject = smarty_mb_str_replace($string, $replace, $subject, $c);
21 $n = max(count($search), count($replace));
23 $subject = smarty_mb_str_replace(current($search), current($replace), $subject, $c);
30 $parts = mb_split(preg_quote($search), $subject);
31 $count = count($parts)-1;
32 $subject = implode($replace, $parts);