Home > Backend Development > PHP Tutorial > How to intercept Chinese and English strings in php_PHP tutorial

How to intercept Chinese and English strings in php_PHP tutorial

WBOY
Release: 2016-07-13 17:32:56
Original
946 people have browsed it

Many friends have been worrying about how to intercept Chinese and English strings in php (as the current mainstream development language) . I have been using this method. You may wish to give it a try.

function str_cut($str_cut,$length){

if(strlen($str_cut) > $length){ //Process the title, if it is too long, use...
for ($i=0; $i < $length; $i++){
                                                                                                                                                       $str_cut,0,$i);
}
return $str_cut;
}


$content="Hard electric plus fgfgfh workers build streets jhkjlk square carry big;l ;l a hard law fdfd country igkdjgkfdg…………………………”;

$content=str_cut($content,$length="25");

echo $ content;

http://www.bkjia.com/PHPjc/508668.html

truehttp: //www.bkjia.com/PHPjc/508668.htmlTechArticleMany friends have been worrying about how to intercept Chinese and English strings in PHP (as the current mainstream development language) , I have been using this method, you might as well give it a try. function str_cut(st...
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