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]);
}ide

相关文章
相关标签/搜索