我有以下数组,来自这样的循环数据:
Array
(
[0] => 24 September 2013
[1] => .................
[2] => .................
[3] => .................
[4] => .................
[5] => 25 September 2013
[6] => .................
[7] => .................
[8] => 27 September 2013
[9] => .................
[10] => .................
[11] => .................
[12] => .................
[13] => 28 September 2013
[14] => .................
[15] => .................
)
如何将此数组转换为按日期分隔的二维,例如:
Array
(
[24 September 2013] => Array
(
[0] => .................
[1] => .................
[2] => .................
[3] => .................
)
[25 September 2013] => Array
(
[0] => .................
[1] => .................
)
[27 September 2013] => Array
(
[0] => .................
[1] => .................
[2] => .................
[3] => .................
)
[28 September 2013] => Array
(
[0] => .................
[1] => .................
)
)
我正在使用 foreach 循环使用 2 个值生成上面的一维数组
$array = Array();
foreach($results as $value) {
$array[] = $value->date;
$array[] = $value->text;
}