Home > Backend Development > PHP Tutorial > String segmentation problem with mixed Chinese and English numbers under PHP_PHP tutorial

String segmentation problem with mixed Chinese and English numbers under PHP_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:39:06
Original
1118 people have browsed it

I spent some time searching online and found nothing.
Later I thought of a way, which I think is original.
Just use the interception and replacement function.

Copy code The code is as follows:

function smssubstr($string, $length) {
if(strlen($ string) <= $length) {
return $string;
}
$strcut = '';
for($i = 0; $i < $length; $i++) {
$strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
}
return $strcut;
}
for($i=1; $i<=$smsnum; $i++){
${'smscontent'.$i} = smssubstr($message,$smsper) ;
$message = str_replace(${'smscontent'.$i},"",$message);
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321619.htmlTechArticleI spent some time searching online and found nothing. Later, I came up with a way, which I think is original. Just use the interception and replacement function. Copy the code The code is as follows: function smss...
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