时性能会很差
基于此数据:
Array
(
[from] => Array
(
[0] => Array
(
[0] => 2015-08-23 15:33:14
[1] => 2015-08-23 15:38:01
)
[1] => Array
(
[0] => 2015-08-23 09:39:23
[1] => 2015-08-23 15:44:23
)
)
[to] => Array
(
[0] => Array
(
[0] => 2015-08-23 15:38:01
[1] => 2015-08-23 15:42:22
)
[1] => Array
(
[0] => 2015-08-23 15:44:23
[1] => 2015-08-23 18:15:38
)
)
)
我需要这样的结果:array[from][0][0]结合array[to][0][0]作为array[0][0]
[0] => Array
(
[0] => Array
(
[from] => 2015-08-23 15:33:14
[to] => 2015-08-23 15:38:01
)
...
)
...
我尝试了许多循环(它很丑),我怀疑当大量数据
我想这个会成功的。
$count1 = count($data);
$result = array();
for($i = 0; $i < $count1; $i++) {
$count2 = count($data['from'][$i]);
for($j = 0; $j < $count2; $j++) {
$result[$i][$j] = array(
"from" => $data['from'][$i][$j],
"to" => $data['to'][$i][$j]
);
}
}