`
haohappy2
  • 浏览: 315072 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

how to count chinese character

    博客分类:
  • PHP
 
阅读更多
<?php
$cityname="上海"
$pa = '/[\x{4e00}-\x{9fa5}]/siu';
preg_match_all($pa, $cityname, $r);
$count = count($r[0]);// can't set one word
echo $count;

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics