直接上例子喽!
$json = "了asd123fa是多少dfsad";
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;
}
$arr=mbstringtoarray($json,"utf-8");
print_r($arr);
上结果: