array1:
Array
(
"Page change" => Array
(
Array("parent_id" =>,"access_id" => 1),
Array("parent_id" =>,"access_id" => 2),
Array("parent_id" =>2,"access_id" =>3),
Array("parent_id" =>2,"access_id" =>4),
Array("parent_id" =>,"access_id" =>5),
Array("parent_id" =>5,"access_id" =>6),
)
"Roles" => Array
(
Array("parent_id" =>5,"access_id" =>7),
Array("parent_id" =>,"access_id" =>8),
)
)
Array2:
Array
(
[Page change] => Array
(
[0] => Array
(
[parent_id] =>
[access_id] => 1
)
[1] => Array
(
[parent_id] =>
[access_id] => 2
[sub]=>array(
[0]=>Array
(
[parent_id] => 2
[access_id] => 3
)
[1] => Array
(
[parent_id] => 2
[access_id] => 4
)
)
)
[2] => Array
(
[parent_id] =>
[access_id] => 5
[sub]=>array(
[0] => Array
(
[parent_id] => 5
[access_id] => 6
)
)
)
)
[Roles] => Array
(
[0] => Array
(
[parent_id] =>
[access_id] => 7
)
[1] => Array
(
[parent_id] =>
[access_id] => 8
)
)
)
我正在努力改变数组的结构。我的结果数组就像我的代码中的结构数组一样。我需要在第一个数组中使用parent_id和access_id来改变数组二。我怎么可能重新排列这个多维数组
如果需要添加" sub"键入每个内部数组。
感谢您的帮助