Php supports Chinese character string splitting functions ,. Php supports Chinese character string splitting functions. str_split does not support Chinese characters. use the mb_xx function to implement * Convertastringtoanarray * @ paramstring $ str * @ paramnumber $ split_leng php supports Chinese character string splitting functions,
Str_split does not support Chinese characters. use the mb_xx function to implement
/*** Convert a string to an array * @ param string $ str * @ param number $ split_length * @ return multitype: string */function mb_str_split ($ str, $ split_length = 1, $ charset = "UTF-8") {if (func_num_args () = 1) {return preg_split ('/(?
Method 2:
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 is all the content of this article. I hope you will like it.
Struct and str_split do not support Chinese characters. use the mb_xx function to implement a/*** Convert a string to an array * @ param string $ str * @ param number $ split_leng...