Home >Backend Development >PHP Problem >What should I do if php mb_substr does not execute?
Solution to php mb_substr not executing: 1. Find and open the php.ini configuration file; 2. Find the "extension=mbstring" item, and then delete the semicolon in front of the item; 3. Save php Just modify the .ini file.
The operating environment of this tutorial: Windows 10 system, PHP version 8.1, DELL G3 computer
What should I do if php mb_substr does not execute?
mb_substr () function returns a part of the string. We have learned the substr () function before. It only targets English characters. If you want to split Chinese characters, you need to use mb_substr (). mb_substr cannot be used. The biggest reason is that the ";" sign in front of "extension=mbstring" is not removed from the php.ini file.
mb_substr() introduction:
mb_substr() function returns a part of the string. We have learned the substr() function before. It only targets English characters. If you want to split Chinese characters, you need Use mb_substr().
Note: If the start parameter is negative and length is less than or equal to start, length is 0.
Syntax
mb_substr ( string $str , int $start [, int $length = NULL [, string $encoding = mb_internal_encoding() ]] ) : string
Parameters
str Required. Extracts a substring from this string.
start Required. Specifies where in the string to begin.
Positive number - starts at the specified position in the string
Negative number - starts at the specified position from the end of the string
0 - at the first character in the string Start at
length Optional. Specifies the length of the string to be returned. The default is until the end of the string.
Positive number - returned from the position of the start parameter
Negative number - returned from the end of the string
encoding Optional. Character Encoding. If omitted, the internal character encoding is used.
Return value: Returns the extracted part of the string, returns FALSE if it fails, or returns an empty string.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if php mb_substr does not execute?. For more information, please follow other related articles on the PHP Chinese website!