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

PHP calculation string interception problem

WBOY
Release: 2016-09-14 09:23:59
Original
1095 people have browsed it

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!

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