In PHP, a Chinese character array is sorted by the first letter of the pinyin alphabet, and the php Array

Source: Internet
Author: User

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:

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.