$a = array(
0=>array('id'=>4,'uID'=>3,'title'=>"test"),
1=>array('id'=>5,'uID'=>4,'title'=>"test2"),
3=>array('id'=>6,'uID'=>5,'title'=>"test3"),
4=>array('id'=>7,'uID'=>6,'title'=>"test9")
);
$b = array(
0=>array('uID'=>3,'name'=>"icq"),
1=>array('uID'=>4,'name'=>"mmcy"),
2=>array('uID'=>5,'name'=>"sdf,asd,sdfsdf,2008,esemnh")
);
合并后
$c = array(
0=>array('id'=>4,'uID'=>3,'title'=>"test",'name'=>"icq"),
1=>array('id'=>5,'uID'=>4,'name'=>"mmcy"),
3=>array('id'=>6,'uID'=>5,'name'=>"sdf,asd,sdfsdf,2008,esemnh"),
4=>array('id'=>7,'uID'=>6,'title'=>"test9")
);
即 当数组a中的uID 与 数组b中的uID相等时就进行合并,并保持 a的索引不变
请问如何做呢? |