Home >Backend Development >PHP Tutorial >汉字转换拼音的有关问题
汉字转换拼音的问题
想要把汉字的首字母提出来,网上搜到下面这个函数,不过让人很郁闷的是很多较为不常用的汉字无法识别,例如饽、窦、鹬...等等。不知道该如何解决。
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function getfirstchar($s0){ $firstchar_ord=ord(strtoupper($s0{0})); if (($firstchar_ord>=65 and $firstchar_ord=48 and $firstchar_ord=-20319 and $asc=-20283 and $asc=-19775 and $asc=-19218 and $asc=-18710 and $asc=-18526 and $asc=-18239 and $asc=-17922 and $asc=-17417 and $asc=-16474 and $asc=-16212 and $asc=-15640 and $asc=-15165 and $asc=-14922 and $asc=-14914 and $asc=-14630 and $asc=-14149 and $asc=-14090 and $asc=-13318 and $asc=-12838 and $asc=-12556 and $asc=-11847 and $asc=-11055 and $asc