Home > Backend Development > PHP Problem > How can I intercept php Chinese without garbled characters?

How can I intercept php Chinese without garbled characters?

藏色散人
Release: 2023-03-11 12:04:02
Original
2811 people have browsed it

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 ...)" .

How can I intercept php Chinese without garbled characters?

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
Copy after login

How can I intercept php Chinese without garbled characters?

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template