$str = '御御御坂坂网络,欢迎迎迎你!heeeelllooo,2001500004300000';
function mbstringtoarray($str,$charset) {
$strlen=mb_strlen($str);
while($strlen){
$array[]=mb_substr($str,0,1,$charset);
$str=mb_substr($str,1,$strlen,$charset);
$strlen=mb_strlen($str);
}
return $array;
}
echo $str."
";
$arr = mbstringtoarray($str,"utf-8"); //分割字符串
$arr =array_unique($arr); //过滤重复字符
$str = implode('',$arr); //合并数组
echo $str;
?>
网友评论