php二维数组合并问题
例如:A数组:Array([0]=>Array([classid]=>1[data1]=>11[date]=>'2011-07-05')[1]=>Array([class...
例如:
A数组:
Array (
[0] => Array ( [classid] => 1[data1] => 11[date]=>'2011-07-05')
[1] => Array ( [classid] => 2[data1] => 12[age]=>'2011-07-05')
[1] => Array ( [classid] => 3[data1] => 13[age]=>'2011-07-05')
)
B数组:
Array (
[0] => Array ( [classid] => 1[data2] => 21[date]=>'2011-07-05')
[1] => Array ( [classid] => 2[data2] => 22[date]=>'2011-07-05')
[1] => Array ( [classid] => 3[data2] => 23[date]=>'2011-07-05')
)
要求合并后的C数组:
Array (
[0] => Array ( [classid] => 1[data1] => 11[data2]=>21[date]=>'2011-07-05')
[1] => Array ( [classid] => 2[data1] => 12[data2]=>22[date]=>'2011-07-05')
[1] => Array ( [classid] => 3[data1] => 13[data2]=>23[date]=>'2011-07-05')
)
其中两个源数组A和B的data*的这个key的名字是可变的,就是也可能是data3,data4等等,大虾帮忙 展开
A数组:
Array (
[0] => Array ( [classid] => 1[data1] => 11[date]=>'2011-07-05')
[1] => Array ( [classid] => 2[data1] => 12[age]=>'2011-07-05')
[1] => Array ( [classid] => 3[data1] => 13[age]=>'2011-07-05')
)
B数组:
Array (
[0] => Array ( [classid] => 1[data2] => 21[date]=>'2011-07-05')
[1] => Array ( [classid] => 2[data2] => 22[date]=>'2011-07-05')
[1] => Array ( [classid] => 3[data2] => 23[date]=>'2011-07-05')
)
要求合并后的C数组:
Array (
[0] => Array ( [classid] => 1[data1] => 11[data2]=>21[date]=>'2011-07-05')
[1] => Array ( [classid] => 2[data1] => 12[data2]=>22[date]=>'2011-07-05')
[1] => Array ( [classid] => 3[data1] => 13[data2]=>23[date]=>'2011-07-05')
)
其中两个源数组A和B的data*的这个key的名字是可变的,就是也可能是data3,data4等等,大虾帮忙 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询