echo $str = "43fdf测试fdsfadaf43543543职工问防盗锁防盗锁5345gfdgd"; preg_match_all("/[0-9]{1}/",$str,$arrNum); preg_match_all("/[a-zA-Z]{1}/",$str,$arrAl); preg_match_all("/([/x{4e00}-/x{9fa5}]){1}/u",$str,$arrCh); echo "<pre>"; echo "数字个数:".count($arrNum[0])."<br/>"; echo "字母个数:".count($arrAl[0])."<br/>"; echo "中文个数:".count($arrCh[0]);