<?php $tmp = @iconv('gbk', 'utf-8', 'dawn生'); if(!empty($tmp)){ $str = $tmp; } preg_match_all('/./u', $str, $match); echo count($match[0]);?>