I have done string comparison before using the lcs algorithm, which involves breaking up strings into arrays. Due to Chinese issues, it is not possible to use str_split directly. You need to use preg_split
你可以封装一个公共函数
function mb_str_split($str)
{
return preg_split('/(?<!^)(?!$)/u' , $str);
}
The string itself can be used as an array $str = "abcdef"; You output $str[0].$str[1].$str[2]; You will find that it is actually $str array(" a","b","c","d","e","f");
I found that I can use the function str_split
I have done string comparison before using the lcs algorithm, which involves breaking up strings into arrays. Due to Chinese issues, it is not possible to use str_split directly. You need to use preg_split
The string itself can be used as an array
$str = "abcdef";
You output $str[0].$str[1].$str[2];
You will find that it is actually $str
array(" a","b","c","d","e","f");
$str = 'adfdf';
explode doesn’t work?