In PHP, a Chinese character array is sorted by the first letter of the pinyin alphabet, and the php Array
(The previous blog post had to resend it because it contained sensitive keywords)
<? Php $ str = "we can see in the browser that when you move the mouse over the element, the element begins to move to the right, and starts slowly. Then it is faster. When you move it away, press the original curve to return to the origin. "; $ Len = mb_strlen ($ str); $ sta = []; for ($ I = 0; $ I <$ len; $ I ++) {$ tmp = mb_substr ($ str, $ I, 1); if ($ tmp! = "") {Array_push ($ sta, $ tmp) ;}// convert Chinese characters to gbk encoding. The array must be converted to a string and then encoded, finally, convert the string into an array $ sta = eval ('Return '. mb_convert_encoding (var_export ($ sta, true), "gbk", "UTF-8 "). ";"); // sort by array value sort ($ sta); // convert Chinese characters to UTF-8 encoded $ sta = eval ('Return '. mb_convert_encoding (var_export ($ sta, true), "UTF-8", "gbk "). ";"); var_dump ($ sta );
In PHP, sort a Chinese character array by the first letter of the pinyin alphabet.
Knowledge point: