Home>Article>Backend Development> php gets the number of words iconv_strlen in mixed English and Chinese

php gets the number of words iconv_strlen in mixed English and Chinese

WBOY
WBOY Original
2016-08-08 09:28:13 1662browse

When the encoding of our web page is utf-8, we can use this:

iconv_strlen( $str, "utf-8") to get the word count of $str

For example: iconv_strlen("Hello hehe","utf-8") //6

The above introduces how to obtain iconv_strlen, the number of words mixed in English and Chinese, in PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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