我打破了我的想法。我需要连接来自不同数据表的三个数据集。一个ID有第二个密钥,第二个到第三个密钥(ID - >如果UF_DRIVER有ID - > NAME1或ID - >如果UF_DRIVER有ID - > NAME2)
有三个数组:$arItems
和$arProps1
以及$arProps2
第一个数组$arItems
的元素:
Array([0] => 2707) Array([0] => 2708)
第二个数组$arProps1
的元素:
Array
(
[0] => Array
(
[ID] => 2707
[UF_VISITOR] => 1909
[UF_DRIVER] =>
)
[0] => Array
(
[ID] => 2708
[UF_VISITOR] =>
[UF_DRIVER] => 1910
)
)

第三个数组的元素$ arProps2:
Array
(
[0] => Array
(
[ID] => 1909
[UF_FIRSTNAME] => NAME1
)
[1] => Array
(
[ID] => 1910
[UF_FIRSTNAME] => NAME2
)
[2] => Array
(
[ID] => 2015
[UF_FIRSTNAME] => NAME3
)
)

如何将这些数组元素合并到一个数组元素中?:
Array([0] => 2707 => Array(
[0] => Array(
[ID] => 2707
[UF_VISITOR] => 1909
[UF_DRIVER] =>
) => Array ([0] => Array([ID] => 1909
[UF_FIRSTNAME] => NAME1
))
Array([0] => 2708 => Array(
[0] => Array(
[ID] => 2708
[UF_VISITOR] =>
[UF_DRIVER] => 1910
) => Array ([0] => Array([ID] => 1910
[UF_FIRSTNAME] => NAME2
))