//取出首字母函數
function getfirstchar($s0){
if(ord($s0)>="1" and ord($s0)//$s=iconv("UTF-8","gb2312", $s0); 如果需要轉換為utf-8的話
$s=$s0;//無需轉換的情況
$asc=ord($s{0})*256+ord($s{1})-65536;
if($asc>=-20319 and $ascif ($asc>=-20283 and $ascif($asc>=-19775 and $ascif($asc>=- 19218 and $ascif($asc>=-18710 and $ascif($asc>=-18526 and $ascif($asc>=-18239 and $ascif($asc>=-17922 and $ascif($asc>=-17417 and $ascif($ asc>=-16212 and $ascif($asc>=-15640 and $asc=-15640 and $asc
if($asc>=-15165 and $ascif($asc>=-14922 and $ >=-14914 及 $ascif($asc>=-14630 and $ascif($asc>=-14090 and $asc
if($asc> =-12838 and $ascif($asc>=-12556 and $asc=-12556 and $asc =
if($asc>=-11847 and $asc if($asc>=-11055 and $asc
?>
以上就介紹了php取出字串(包括漢字)首字母函數,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。