xn_strlen($s)
UTF-8 的编码方式求字符串长度。
函数原型:
function xn_strlen($s) { return mb_strlen($s, "UTF-8"); }
$s:字符串
<?php include "./xiunophp/xiunophp.php"; echo xn_strlen("字符"); // 结果: 2 ?>