Home  >  Article  >  Backend Development  >  10 recommended articles about mb_substr()

10 recommended articles about mb_substr()

伊谢尔伦
伊谢尔伦Original
2017-06-15 13:35:171511browse

The substr() function can be used to split text, but if the text to be split includes Chinese characters, you will often encounter problems. In this case, you can use the mb_substr()/mb_strcut function. The usage of mb_substr()/mb_strcut is the same as that of substr( ) is similar, except that one more parameter needs to be added at the end of mb_substr()/mb_strcut to set the encoding of the string. However, most servers do not open php_mbstring.dll. You need to open php_mbstring.dll in php.ini. For example: Output: This way my word

1. php mb_substr() and mb_strcut() functions to intercept the length of Chinese string

10 recommended articles about mb_substr()

Introduction: The substr() function can be used to split text, but if the text to be split includes Chinese characters, you will often encounter problems. In this case, you can use the mb_substr()/mb_strcut function. The usage of mb_substr()/mb_strcut is similar to substr(), except that multiple

2 must be added at the end of mb_substr()/mb_strcut. php mb_substr() function intercepts Chinese strings Application example

10 recommended articles about mb_substr()

Introduction: The substr() function is used to intercept strings, but Chinese characters will appear Problem, but the two functions mb_substr() and mb_strcut can be used. The following will introduce their specific usage

3. php mb_substr() function interception Chinese string application example

10 recommended articles about mb_substr()

Introduction: The substr() function is used to intercept strings, but there will be problems with Chinese characters, and These two functions, mb_substr() and mb_strcut, can be used. The following will introduce their specific usage

4. php uses mb_substr() to solve the problem of garbled Chinese string interception

10 recommended articles about mb_substr()

Introduction: PHP comes with several string interception functions, among which substr and mb_substr are commonly used. When the former processes Chinese, GBK is 2 length units and UTF is 3 length units. After the latter specifies encoding, one Chinese character is 1 length unit.

5. The difference and usage of substr(), mb_substr() and mb_strcut (Chinese character interception)

10 recommended articles about mb_substr()

Introduction: PHP substr() function can split text, but if the text to be split includes Chinese characters, you will often encounter problems. In this case, you can use mb_substr()/mb_strcut The usage of this function, mb_substr()/mb_strcut is similar to substr(), except that one more parameter needs to be added at the end of mb_substr()/mb_strcut to set the encoding of the string. However, most servers do not open php_mbstring.dll, so you need In php.ini, put p...

6. Solution to the problem of PHP intercepting Chinese strings

10 recommended articles about mb_substr()

Introduction: Solve the problem of intercepting Chinese strings with PHP. If PHP intercepts the string, it is easy to handle. Just use substr directly. Generally, there will be no garbled characters. Chinese is a bit Sorry. Here are two solutions: (1) Just use the mb_substr(); function of the Multi-Byte function library directly. The example code is as follows

7. PHP implements string flipping (including Chinese characters) php randomly generates strings php gets the string length php string ratio

Introduction: String, php:PHP realizes string flipping (including Chinese characters):

##8. submithandler PHP Chinese processing Chinese string interception mb_substr and get the number of Chinese string words

Introduction: submithandler:submithandler PHP Chinese processing Chinese string interception mb_substr and obtaining the number of Chinese string words: 1. Chinese interception: mb_substr()mb_substr($str, $start, $length, $encoding) $str, the characters that need to be truncated String $start, the starting point of truncation, the starting point is 0 $length, the number of words to be intercepted $encoding, web page encoding, such as utf-8, GB2312, GBK Example: Copy the code as follows:

9. Detailed explanation of PHP truncation function mb_substr()

Introduction: PHP truncation Detailed explanation of function mb_substr()

10. php truncate string function mb_substr() example

Introduction: php truncation String function mb_substr() example

[Related Q&A recommendations]:

##substr - PHP - Chinese and English mixed string interception function

The above is the detailed content of 10 recommended articles about mb_substr(). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn