我有一个按月分组的多维元素数组,例如:
Array
(
[2013-01] => Array
(
[0] => Array
(
[Project] => Array
(
[id] => 1
[user_id] => 1
[created] => 2013-04-08 01:00:56
[modified] => 2013-04-08 01:01:40
[vId] => 7
)
)
)
[2013-04] => Array
(
[2] => Array
(
[Project] => Array
(
[id] => 1
[user_id] => 1
[created] => 2013-04-08 01:00:56
[modified] => 2013-04-08 01:01:40
[refimg] => uploads/smallRef.png
)
)
[3] => Array
(
[Project] => Array
(
[id] => 1
[user_id] => 1
[created] => 2013-04-08 01:00:56
[modified] => 2013-04-08 01:01:40
)
)
[4] => Array
(
[Project] => Array
(
[id] => 1
[user_id] => 1
[created] => 2013-04-08 01:00:56
[modified] => 2013-04-08 01:01:40
)
)
)
)
现在我想循环几个月,并且每个月我想对特定月份的数组进行计数:
$currMonth = date('Y-m-d');
while (strtotime($currMonth) >= strtotime($firstMonth)) {
$curM = date('Y-m', strtotime($currMonth));
count($grouparr[$curM]);
$currMonth = date ("Y-m-d", strtotime("-1 month", strtotime($currMonth)));
}
这似乎不起作用。我收到以下错误:
Uncaught SyntaxError: Unexpected token <
如果我手动输入日期一切正常,例如,如果我在上面的代码中替换它:
count($grouparr["2013-01");
我希望有人能告诉我我做错了什么