php 怎么计算字符串长度

如题所述

使用strlen函数

int strlen    ( string $string   )

php文档中的例子

<?php
$str = 'abcdef';
echo strlen($str); // 6

$str = ' ab cd ';
echo strlen($str); // 7
?>
温馨提示:答案为网友推荐,仅供参考
相似回答