php过滤字符串中重复的字符(包含中文)

<?php
header('Content-Type:text/html; Charset=utf-8');
function mb_str_split( $string ) {
    return implode('', array_unique(preg_split('/(?<!^)(?!$)/u', $string ))); 
} 

$string   = '过过过过过ggggg年年年nnnnnn啦啦啦啦啦啦lllll'; 
$charlist = mb_str_split( $string ); 


echo $charlist;


你可能感兴趣的:(php过滤字符串中重复的字符(包含中文))