我有一个array
看起来像objects
:php
Array
(
[0] => Array
(
[day] => 1/23/2013
[executions] => 1
)
[1] => Array
(
[day] => 1/24/2013
[executions] => 1
)
[2] => Array
(
[day] => 1/27/2013
[executions] => 10
)
[3] => Array
(
[day] => 1/29/2013
[executions] => 1
)
[4] => Array
(
[day] => 1/30/2013
[executions] => 3
)
[5] => Array
(
[day] => 2/8/2013
[executions] => 1
)
[6] => Array
(
[day] => 2/11/2013
[executions] => 3
)
)
我正在构建这些数据的图表,基本上它代表过去 30 天。问题是我没有得到丢失的日子,即当查询没有执行时。我希望用 PHP 来填补这些缺失的日子,只需将 设置day
为正确的日期,然后executions
将0
. 因此,结果数组应该包含 30 个元素,假设 start 是1/18/2013
并且 end 是 today 2/17/2013
。
知道在 PHP 中实现这一目标的最佳算法吗?