我有一个包含父母和孩子的多维数组,我想更改数组键
它看起来像这样:
Array
(
[0] => stdClass Object
(
[id] => 108
[parent_id] => 0
[children] => Array
(
[0] => stdClass Object
(
[id] => 71
[parent_id] => 108
[children] => Array
(
[0] => stdClass Object
(
[id] => 107
[parent_id] => 71
[children] => Array
(
[0] => stdClass Object
(
[id] => 78
[parent_id] => 107
)
)
)
)
)
)
)
[1] => stdClass Object
(
[id] => 82
[parent_id] => 0
)
[2] => stdClass Object
(
[id] => 84
[parent_id] => 0
)
[3] => stdClass Object
(
[id] => 88
[parent_id] => 0
)
[4] => stdClass Object
(
[id] => 92
[parent_id] => 0
)
)
例如,我想移动数组 [id] => 88 下方 id 为 108 的数组。问题是将数组移动到新位置但同时移动子数组。