php把一个二维数组的值插入到对应的多维数组里面,键值相同:

Array1
(
[root_iobv_1414491084578] => Array
(
[6460_1_node_ykgd_1414491143251] => Array
(
[6460_2_node_kuof_1414491170390] => Array
(
[6460_1_node_atcj_1414726470012] => 1
)

)

[6460_3_node_clll_1414491288627] => 1
)

)
Array2
(
[root_iobv_1414491084578] => Array
(
[in] => 0
[out] => 181928
[type] => Program
)

[6460_1_node_ykgd_1414491143251] => Array
(
[in] => 5247
[out] => 104327
[type] => Sequence
)

[6460_2_node_kuof_1414491170390] => Array
(
[in] => 25054
[out] => 53591
[type] => Scene
)

[6460_3_node_clll_1414491288627] => Array
(
[in] => 122253
[out] => 139644
[type] => Scene
)

[6460_1_node_atcj_1414726470012] => Array
(
[in] => 35456
[out] => 43932
[type] => Shot
)

)
怎么才能按照键值,把array2的值插入到array1里面去?,得到的新数组结构需要和array1一样,array1长度不固定。

第1个回答  2014-11-01

你这array2的格式和array1不一样啊,单纯array insert的话用array_push

//把array2插到array1中
array_push(array1, array2);

本回答被网友采纳
相似回答