天天看点

PHP 获取字符串长度

<?php 

$str=‘中文a字1符‘; 

echo strlen($str); 

echo ‘<br />‘; 

echo mb_strlen($str,‘UTF8‘); 

//输出结果 

//14 

//6 

?>