我有一个如下所示的三维数组。
Array
(
[d1] => Array
(
[c1] => Array
(
[t1] => Array
(
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 1
[a5] => 1
[a6] => 1
[a7] => 1
)
[t2] => Array
(
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 2
[a6] => 0
[a7] => 1
)
[t3] => Array
(
[a1] => 1
[a2] => 3
[a3] => 2
[a4] => 4
[a5] => 2
[a6] => 2
[a7] => 3
)
)
[c2] => Array
(
[t1] => Array
(
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 2
[a5] => 2
[a6] => 1
[a7] => 2
)
[t2] => Array
(
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 0
[a6] => 0
[a7] => 0
)
[t3] => Array
(
[a1] => 1
[a2] => 1
[a3] => 1
[a4] => 1
[a5] => 2
[a6] => 1
[a7] => 2
)
)
)
[d2] => Array
(
[c1] => Array
(
[t1] => Array
(
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 1
[a5] => 1
[a6] => 1
[a7] => 1
)
[t2] => Array
(
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 2
[a6] => 0
[a7] => 1
)
[t3] => Array
(
[a1] => 1
[a2] => 3
[a3] => 2
[a4] => 4
[a5] => 2
[a6] => 2
[a7] => 3
)
)
[c2] => Array
(
[t1] => Array
(
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 2
[a5] => 2
[a6] => 1
[a7] => 2
)
[t2] => Array
(
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 0
[a6] => 0
[a7] => 0
)
[t3] => Array
(
[a1] => 1
[a2] => 1
[a3] => 1
[a4] => 1
[a5] => 2
[a6] => 1
[a7] => 2
)
)
)
)
这是数组的 PHP 代码:
$data = array(
'd1' => array(
'c1' => array(
't1' => array(
'a1' => 1,
'a2' => 2,
'a3' => 1,
'a4' => 1,
'a5' => 1,
'a6' => 1,
'a7' => 1,
),
't2' => array(
'a1' => 0,
'a2' => 1,
'a3' => 0,
'a4' => 1,
'a5' => 2,
'a6' => 0,
'a7' => 1,
),
't3' => array(
'a1' => 1,
'a2' => 3,
'a3' => 2,
'a4' => 4,
'a5' => 2,
'a6' => 2,
'a7' => 3,
),
),
'c2' => array(
't1' => array(
'a1' => 1,
'a2' => 2,
'a3' => 1,
'a4' => 2,
'a5' => 2,
'a6' => 1,
'a7' => 2,
),
't2' => array(
'a1' => 0,
'a2' => 1,
'a3' => 0,
'a4' => 1,
'a5' => 0,
'a6' => 0,
'a7' => 0,
),
't3' => array(
'a1' => 1,
'a2' => 1,
'a3' => 1,
'a4' => 1,
'a5' => 2,
'a6' => 1,
'a7' => 2,
),
),
),
'd2' => array(
'c1' => array(
't1' => array(
'a1' => 1,
'a2' => 2,
'a3' => 1,
'a4' => 1,
'a5' => 1,
'a6' => 1,
'a7' => 1,
),
't2' => array(
'a1' => 0,
'a2' => 1,
'a3' => 0,
'a4' => 1,
'a5' => 2,
'a6' => 0,
'a7' => 1,
),
't3' => array(
'a1' => 1,
'a2' => 3,
'a3' => 2,
'a4' => 4,
'a5' => 2,
'a6' => 2,
'a7' => 3,
),
),
'c2' => array(
't1' => array(
'a1' => 1,
'a2' => 2,
'a3' => 1,
'a4' => 2,
'a5' => 2,
'a6' => 1,
'a7' => 2,
),
't2' => array(
'a1' => 0,
'a2' => 1,
'a3' => 0,
'a4' => 1,
'a5' => 0,
'a6' => 0,
'a7' => 0,
),
't3' => array(
'a1' => 1,
'a2' => 1,
'a3' => 1,
'a4' => 1,
'a5' => 2,
'a6' => 1,
'a7' => 2,
),
),
),
);
现在我想将此数组拆分为几个数组并将这些数组放入一个数组中,如下所示。
Array
(
[0] => Array
(
[d1] => d1
[c1] => c1
[t1] => t1
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 1
[a5] => 1
[a6] => 1
[a7] => 1
)
[1] => Array
(
[d1] => d1
[c1] => c1
[t1] => t2
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 2
[a6] => 0
[a7] => 1
)
[2] => Array
(
[d1] => d1
[c1] => c1
[t1] => t3
[a1] => 1
[a2] => 3
[a3] => 2
[a4] => 4
[a5] => 2
[a6] => 2
[a7] => 3
)
[3] => Array
(
[d1] => d1
[c1] => c2
[t1] => t1
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 2
[a5] => 2
[a6] => 1
[a7] => 2
)
[4] => Array
(
[d1] => d1
[c1] => c2
[t1] => t2
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 0
[a6] => 0
[a7] => 0
)
[5] => Array
(
[d1] => d1
[c1] => c2
[t1] => t3
[a1] => 1
[a2] => 1
[a3] => 1
[a4] => 1
[a5] => 2
[a6] => 1
[a7] => 2
)
[6] => Array
(
[d1] => d1
[c1] => c1
[t1] => t1
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 1
[a5] => 1
[a6] => 1
[a7] => 1
)
[1] => Array
(
[d1] => d2
[c1] => c1
[t1] => t2
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 2
[a6] => 0
[a7] => 1
)
[7] => Array
(
[d1] => d2
[c1] => c1
[t1] => t3
[a1] => 1
[a2] => 3
[a3] => 2
[a4] => 4
[a5] => 2
[a6] => 2
[a7] => 3
)
[8] => Array
(
[d1] => d2
[c1] => c2
[t1] => t1
[a1] => 1
[a2] => 2
[a3] => 1
[a4] => 2
[a5] => 2
[a6] => 1
[a7] => 2
)
[9] => Array
(
[d1] => d2
[c1] => c2
[t1] => t2
[a1] => 0
[a2] => 1
[a3] => 0
[a4] => 1
[a5] => 0
[a6] => 0
[a7] => 0
)
[10] => Array
(
[d1] => d2
[c1] => c2
[t1] => t3
[a1] => 1
[a2] => 1
[a3] => 1
[a4] => 1
[a5] => 2
[a6] => 1
[a7] => 2
)
)
寻找任何想法如何进行......