我从我的选择语句中得到这个:
Array
(
[0] => Array
(
[time] => 2013-11-06 09:15:00
[type] => 1
)
[1] => Array
(
[time] => 2013-11-06 11:00:00
[type] => 2
)
[2] => Array
(
[time] => 2013-11-06 11:15:00
[type] => 3
)
[3] => Array
(
[time] => 2013-11-06 13:00:00
[type] => 4
)
[4] => Array
(
[time] => 2013-11-06 13:29:00
[type] => 5
)
[5] => Array
(
[time] => 2013-11-06 15:00:00
[type] => 6
)
[6] => Array
(
[time] => 2013-11-06 15:15:00
[type] => 7
)
[7] => Array
(
[time] => 2013-11-06 17:00:00
[type] => 8
)
[8] => Array
(
[time] => 2013-11-07 09:00:00
[type] => 1
)
[9] => Array
(
[time] => 2013-11-07 10:15:00
[type] => 2
)
[10] => Array
(
[time] => 2013-11-07 10:30:00
[type] => 3
)
[11] => Array
(
[time] => 2013-11-07 13:00:00
[type] => 4
)
[12] => Array
(
[time] => 2013-11-07 13:30:00
[type] => 5
)
[13] => Array
(
[time] => 2013-11-07 14:30:00
[type] => 6
)
[14] => Array
(
[time] => 2013-11-07 14:45:00
[type] => 7
)
[15] => Array
(
[time] => 2013-11-07 17:00:00
[type] => 8
)
)
我想要做的是按日期对数组进行分组并将每个时间值设置为该数组的一个元素,但是将键从 [time] 更改为分配给 [type] 的数值。
所以我会得到这样的东西:
$records[] = array();
$records[2013-11-06] => Array
( [1] => 09:15:00
[2] => 11:15:00
[3] => 11:15:00
etc.
)
$records[2013-11-07] => Array
( [1] => 09:00:00
[2] => 10:15:00
[3] => 10:30:00
etc.
)
非常感谢任何帮助,因为我被困住了!谢谢!