我有一个看起来像这样的数组:
$someArray = array(
array(
"id"=> 1,
"name"=> "somename1",
"parent"=> 0
),
array(
"id"=> 53,
"name"=> "somename2",
"parent"=> 1
),
array(
"id"=> 921,
"name"=> "somename3",
"parent"=> 53,
)
.
.
.
.
.
.
);
Ofcs 数组中有更多单元格,这只是一小部分
我正在尝试将此数组转换为:
$someArray = array(
array(
"id"=> 1,
"name"=> "somename1",
"parent"=> 0,
"children" => array(
array(
"id"=> 53,
"name"=> "somename2",
"parent"=> 1,
"children" => array(
array(
"id"=> 921,
"name"=> "somename3",
"parent"=> 53,
"children" => array(
)
)
)
)
)
)
.
.
.
.
.
.
);
我试了一天半,似乎无法完成。
先谢谢了。