标签: 汉字
用PHP把汉字转化为拼音
<?php
$d=array(
array(“a”,-20319),
array(“ai”,-20317),
array(“an”,-20304),
array(“ang”,-20295),
array(“ao”,-20292),
array(“ba”,-20283),
array(“bai”,-20265),
array(“ban”,-20257),
array(“bang”,-20242),
array(“bao”,-20230),[……]
PHP获取汉字拼音首字母
<?php
function getfirstchar($s0){
$fchar = ord($s0{0});
if($fchar >= ord(“A”) and $fchar <= ord(“z”) )return strtoupper($s0{0});
$s1 = iconv(“UTF-8″,”gb2312”, $s0);
$s2 = iconv(“gb2312″,”UTF-8”, $s1);
if($s2 == $s0){$s = $s1;}else{[……]