//中文字符长度,一个中文长度为1。 function cstrlen($str){ $n = 0; $p = 0; $c = ”; $len = strlen($str);
for($i = 0; $i < $len; $i++) { $c = ord($str{$i}); if($c > 127) { $p = 1; } else { $p = 0; } $i+=$p;$n++; }
return $n; }
Popularity: 11%
No Responses to “中文字符长度”
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>