我有两个数组:
打印数组,每个项目都是一行表格
array(
[1] => array(
[data] = array(
[parent] = NULL,
[depth] = 1
);
);
[2] => array(
[data] = array(
[parent] = 1,
[depth] = 2
);
);
[3] => array(
[data] = array(
[parent] = 1,
[depth] = 2
);
);
[4] => array(
[data] = array(
[parent] = 2,
[depth] = 3
);
);
[5] => array(
[data] = array(
[parent] = NULL,
[depth] = 1
);
);
[6] => array(
[data] = array(
[parent] = 5,
[depth] = 2
);
);
);
按维度排序的数组
array(
[1] => array(
[data] = array(
[parent] = NULL,
[depth] = 1
);
[children] => array(
[2] => array(
[data] = array(
[parent] = 1,
[depth] = 2
);
[children] => array(
[4] => array(
[data] = array(
[parent] = 2,
[depth] = 3
);
);
);
);
[3] => array(
[data] = array(
[parent] = 1,
[depth] = 2
);
);
);
);
[5] => array(
[data] = array(
[parent] = NULL,
[depth] = 1
);
[children] => array(
[6] => array(
[data] = array(
[parent] = 5,
[depth] = 2
);
);
);
);
);
我想获得这个数组(这与whitch无关):
array(
[1] => array(
[1] = array(
[parent] = NULL,
[depth] = 1
);
);
[2] => array(
[1] = array(
[parent] = NULL,
[depth] = 1
);
[2] = array(
[parent] = 1,
[depth] = 2
);
);
[3] => array(
[1] = array(
[parent] = NULL,
[depth] = 1
);
[2] = array(
[parent] = 1,
[depth] = 2
);
);
[4] => array(
[1] = array(
[parent] = NULL,
[depth] = 1
);
[2] = array(
[parent] = 1,
[depth] = 2
);
[3] = array(
[parent] = 2,
[depth] = 3
);
);
[5] => array(
[1] = array(
[parent] = NULL,
[depth] = 1
);
);
[6] => array(
[1] = array(
[parent] = NULL,
[depth] = 1
);
[2] = array(
[parent] = 5,
[depth] = 2
);
);
);
这是我可以通过id看到每个父母的数组。有人知道吗?