Home > Backend Development > PHP Tutorial > 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
Release: 2016-08-08 09:28:13
Original
1753 people have browsed it

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.

Related labels:
utf
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