//壓入首字母
foreach ($res as $k => $v)
{
$res[$k]['first'] = strtoupper(substr(trim($v['name']), 0, 1));
$arr = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
//如果不是字母 把他規劃到0-9隊列
if (!in_array($res[$k]['first'], $arr))
{
$res[$k]['first'] = '0-9';
}
}
foreach ($res as $k => $v)
{
$result[$v['first']][] = $v;
}
ksort($result);