Use the multi-byte processing function provided by php to process Chinese characters. The best way is to use the PHP Tutorial.

Source: Internet
Author: User
It is the best method to use the multi-byte processing function provided by php to process Chinese characters. Echo __________________________; $ string242432 the objection is 456, which constitutes a widely used Embassy in 7890abc; $ mb_strlenmb_strlen ($ string); $ len20; echo $ string .; the total echo length is :. ($ m echo"

__________________________

";
$ String = "242432 objection: 456, which is equivalent to 7890abc in a wide range of embassy places ";
$ Mb_strlen = mb_strlen ($ string );
$ Len = 20;
Echo $ string ."

";
Echo "Total length:". ($ mb_strlen + 1 )."

";
Echo "number of interceptions:". $ len ."

";
For ($ I = 1; $ I <= $ mb_strlen + 1; $ I ++ ){
If ($ I> $ len ){
Echo $ I ."". Mb_substr ($ string, $ I )."...
";
Continue;
}
Echo $ I ."". Mb_substr ($ string, $ I )."
";
}
?>
See the Multi-Byte String Functions in PHP,
(1) use -- enable-mbstring = cn during compilation
(2) modify/usr/local/lib/php. inc
Default_charset = "zh-cn"
Mbstring. language = zh-cn
Mbstring. internal_encoding = zh-cn
Everthing I do, I do it for you!
My linux!


Http://www.bkjia.com/PHPjc/445600.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445600.htmlTechArticleecho __________________________; $ string = 242432 objection is 456, which makes extensive embassy place 7890abc; $ mb_strlen = mb_strlen ($ string); $ len = 20; echo $ string .; the total echo length is :. ($ m...

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.