Differences between functions of the mb_series function and functions of common characters.

Source: Internet
Author: User

Differences between functions of the mb_series function and functions of common characters.

The mb function isFunction Extension for processing text based on the encoding format.

Modify the/etc/php. ini configuration file and add extension = php_mbstring.so.

 

Use the substr function that is most commonly used as an example. Clear at a glance.

Example:

1 <? Php 2 // phpinfo (); 3 $ str = 'abcdef '; 4 echo strlen ($ str); // 6 5 echo' <br/> '; 6 echo substr ($ str, 1, 2); // bc 7 echo '<br/>'; 8 9 $ str2 = 'Who am I AB '; 10 echo substr ($ str2, 2, 2); // �� 11 echo '<br/>'; 12 echo mb_substr ($ str2, 2, 2, 'utf-8 '); // who a13 echo '<br/>'; 14 echo strlen ($ str2); // 1115 echo '<br/>'; 16 echo mb_strlen ($ str2, 'utf-8'); // 517 echo '<br/> ';

 

You can see lines 10th and 12 clearly.

 

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.