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

PHP calculation string interception problem

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-09-14 09:23:59
Original
1128 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
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template