天天看點

PHP 擷取字元串長度

<?php 

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

echo strlen($str); 

echo ‘<br />‘; 

echo mb_strlen($str,‘UTF8‘); 

//輸出結果 

//14 

//6 

?>