comparison reclib.php @ 119:b172a0b1ea48

revoke mb_str_replace for now
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 15 Mar 2010 01:39:14 +0900
parents f268d7d10590
children 0ded1d3bd448
comparison
equal deleted inserted replaced
118:db185340a981 119:b172a0b1ea48
19 "alert(\"". $message . "\");\n". 19 "alert(\"". $message . "\");\n".
20 "window.open(\"".$url."\",\"_self\");". 20 "window.open(\"".$url."\",\"_self\");".
21 "// -->\n</script>" ); 21 "// -->\n</script>" );
22 } 22 }
23 23
24 // マルチバイトstr_replace
25
26 function mb_str_replace($search, $replace, $target, $encoding = "UTF-8" ) {
27 $notArray = !is_array($target) ? TRUE : FALSE;
28 $target = $notArray ? array($target) : $target;
29 $search_len = mb_strlen($search, $encoding);
30 $replace_len = mb_strlen($replace, $encoding);
31
32 foreach ($target as $i => $tar) {
33 $offset = mb_strpos($tar, $search);
34 while ($offset !== FALSE){
35 $tar = mb_substr($tar, 0, $offset).$replace.mb_substr($tar, $offset + $search_len);
36 $offset = mb_strpos($tar, $search, $offset + $replace_len);
37 }
38 $target[$i] = $tar;
39 }
40 return $notArray ? $target[0] : $target;
41 }
42
43 ?> 24 ?>