PHP计算字符串的个数的方法,如下代码:
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计算字符串的个数的方法,如下代码:
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]);
}