In PHP, you can use the mb_substr function to intercept Chinese without garbled characters. Its usage syntax is "mb_substr (string $str, int $start [, int $length = NULL [, string ...)" .
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php How can I intercept Chinese without garbled characters?
In PHP, you can use the mb_substr function to intercept Chinese without garbled characters.
The 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().
Note: If the start parameter is negative and length is less than or equal to start, length is 0.
Grammar
mb_substr ( string $str , int $start [, int $length = NULL [, string $encoding = mb_internal_encoding() ]] ) : string
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How can I intercept php Chinese without garbled characters?. For more information, please follow other related articles on the PHP Chinese website!