标签:
$a=array(
array(a,b,c),
array(c,d,e),
);
foreach($a as $k=>$v){
foreach($v as $value){
if(!in_array($value,$ids))
$ids[] = $value;
}
}
foreach($a as $k=>$v){
foreach($v as $value){
foreach($ids as $key=>$id){
if($id == $value){
$res[$key][‘id‘] = $id;
$res[$key][‘num‘]++;
}
}
}
}
dump($ids);
dump($res);
标签:
原文地址:http://www.cnblogs.com/langxi/p/4538156.html