首页 > Web开发 > 详细

PHP计算字符串的个数

时间:2016-08-15 14:41:45      阅读:235      评论:0      收藏:0      [点我收藏+]

function stringLength($string){
    $re[‘utf-8‘]   = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
    preg_match_all($re[‘utf-8‘], $string, $match);
    return count($match[0]);
}

PHP计算字符串的个数

原文:http://ouyangjun.blog.51cto.com/10284323/1838030

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!