//需要重组的数组
$arrar=array();
$array[]=array('ItemID' => 110126866896,'CategoryID'=>111);
$array[]=array('ItemID' => 120126866896,'CategoryID'=>112);
$array[]=array('ItemID' => 130126866896,'CategoryID'=>113);
$array[]=array('ItemID' => 140126866896,'CategoryID'=>114);
$array[]=array('ItemID' => 150126866896,'CategoryID'=>115);
$array[]=array('ItemID' => 160126866896,'CategoryID'=>116);
$array[]=array('ItemID' => 170126866896,'CategoryID'=>117);
$array[]=array('ItemID' => 118126866896,'CategoryID'=>111);
$array[]=array('ItemID' => 121126866896,'CategoryID'=>112);
$array[]=array('ItemID' => 132126866896,'CategoryID'=>113);
$array[]=array('ItemID' => 143126866896,'CategoryID'=>114);
$array[]=array('ItemID' => 154126866896,'CategoryID'=>115);
$array[]=array('ItemID' => 165126866896,'CategoryID'=>116);
$array[]=array('ItemID' => 176126866896,'CategoryID'=>117);
//数组根据分类进行重组
$newArray=array();
foreach($array as $val){
$newArray[$val['CategoryID']][]=$val;
}
//删除原始数组释放空间
$array=null;
unset($array);
print_r($newArray);
?>
|