佘小宝的爹 发表于 2018-12-16 07:25:38

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



页: [1]
查看完整版本: PHP计算字符串的个数