php 根据相同值在分组
$arr = array ( 0 => array ( 'initial' => 'A', 'typename' => '奥迪' ), 1 => array ( 'initial' => 'F', 'typename' =>'F1' ), 2 => array ( 'initial' => 'F', 'typename' => 'F2' ) ); $result = array(); foreach($arr as $k=>$v){ $result[$v['initial']][] = $v; } //得到的$result就包括你需要的内容了