Home >Backend Development >PHP Tutorial >PHP calculation string interception problem

PHP calculation string interception problem

WBOY
WBOYOriginal
2016-09-14 09:23:591115browse

There is a function on my page that needs to be replaced by ellipsis if the string is too long. Now I use strlen and substr to implement it. I found that the length of intercepted text in Chinese and English is different, resulting in too little interception in Chinese, and the interception in English is the set length. The same. Is there any good way to unify Chinese and English? I am speechless!

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