PHP supports the Chinese string segmentation function,
Str_split does not support Chinese and uses MB_XX functions to implement a
/** * Convert A string to an array * @param string $str * @param number $split _length * @return multitype:string */functio N Mb_str_split ($str, $split _length=1, $charset = "UTF-8") {if (Func_num_args () ==1) {return preg_split ('/(?
Method Two:
function Mbstrsplit ($string, $len =1) { $start = 0; $strlen = Mb_strlen ($string); while ($strlen) { $array [] = Mb_substr ($string, $start, $len, "UTF8"); $string = Mb_substr ($string, $len, $strlen, "UTF8"); $strlen = Mb_strlen ($string); } return $array;}
The above mentioned is the whole content of this article, I hope you can like.
http://www.bkjia.com/PHPjc/1008003.html www.bkjia.com true http://www.bkjia.com/PHPjc/1008003.html techarticle PHP supports Chinese string segmentation function, Str_split does not support Chinese, using MB_XX function to implement a/** * Convert a string to an array * @param string $STR * @param number $ Split_leng ...