Method One:
Copy Code code as follows:
$text = ' array AABBCCDD ';
$text _filter = ';
$filter = Array ();
$len = Mb_strlen ($text, ' utf-8 ');
for ($i = 0; $i < $len; $i + +) {
$char = Mb_substr ($text, $i, 1, ' utf-8 ');
if (!isset ($filter [$char])) {
$text _filter. = $char;
$filter [$char] = $char;
}
}
Echo $text _filter;
Method Two:
Copy Code code as follows:
$string = ' array AABBCCDD ';
function Str_split_utf8 ($STR) {
$split = 1;
$array = Array ();
for ($i =0; $i < strlen ($STR);) {
$value = Ord ($str [$i]);
if ($value > 127) {
if ($value >= && $value <= 223)
$split = 2;
ElseIf ($value >= 224 && $value <= 239)
$split = 3;
ElseIf ($value >= && $value <= 247)
$split = 4;
}else{
$split = 1;
}
$key = NULL;
for ($j = 0; $j < $split; $j + +, $i + +) {
$key. = $str [$i];
}
Array_push ($array, $key);
}
return $array;
}
Print_r (Array_unique (Str_split_utf8 ($string)));
Method Three:
is to divide each word into an array and use the Array_unique () function.