PHP--获取字符串长度

strlen函数对于计算英文字符长度

如果有中文汉字,可以使用mb_strlen()函数获取字符串中中文长度。

示例:

$str = 'hello';$len = strlen($str);echo $len;//输出结果是5

posted on 2016-08-24 00:15  Lsec  阅读(337)  评论(0编辑  收藏  举报

导航