php批量獲取首字母(漢字
$mysql_server_name=
$mysql_username=
$mysql_password=
$mysql_database=
mysql_connect(
mysql_select_db($mysql_database);
mysql_query("SET NAMES
$equery
$result
while ($row = mysql_fetch_array($result
{
$title=$row["title"];
if (ord($title)>
echo $letter=getfirstchar($title);
}else if(ord($title)>=
echo $letter=iconv_substr($title
}else if(ord($title)>=
echo $letter=iconv_substr($title
}else if(ord($title)>=
echo $letter=iconv_substr($title
}
}
function getfirstchar($s
$s=iconv("UTF
$asc=ord($s{
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
if($asc>=
return false;
}
From:http://tw.wingwit.com/Article/program/PHP/201311/20913.html