Home  >  Article  >  php教程  >  php中英数字混排的字符串分割代码

php中英数字混排的字符串分割代码

WBOY
WBOYOriginal
2016-06-08 17:27:52844browse

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

 

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