<?
$str = "as2事aa件b查c看asfasdfasdfafsd你是砂工d器asdf ";
$j = 0;
for($i=1;$i <strlen($str);$i++)
{
if(ord(substr($str,$i,1))> 0xa0)
{
$j++;
$i++;
}
}
echo "有 ".$j. "个中汉字 ";
?>
转载于:https://www.cnblogs.com/DavidYan/articles/2032364.html