<?php
function get_weekly($start, $end)
{
$dates = array();
while($start < $end) {
array_push($dates,date("D m y",$start));
$start = $start + (86400 * 7); // perhaps erroneous concept of the number of seconds in a week
}
return $dates;
}
$start = strtotime("Tue 10th Jul 2012");
$end = strtotime("Tue 10th Jul 2013");
echo "<pre>";
print_r(get_weekly($start, $end));
echo "</pre";
?>
And the results which I think amount to a bug in PHP:
Array
(
[0] => Tue 07 12
[1] => Tue 07 12
[2] => Tue 07 12
[3] => Tue 07 12
[4] => Tue 08 12
[5] => Tue 08 12
[6] => Tue 08 12
[7] => Tue 08 12
[8] => Tue 09 12
[9] => Tue 09 12
[10] => Tue 09 12
[11] => Tue 09 12
[12] => Tue 10 12
[13] => Tue 10 12
[14] => Tue 10 12
[15] => Tue 10 12
[16] => Tue 10 12
[17] => Mon 11 12
[18] => Mon 11 12
[19] => Mon 11 12
[20] => Mon 11 12
[21] => Mon 12 12
[22] => Mon 12 12
[23] => Mon 12 12
[24] => Mon 12 12
[25] => Mon 12 12
[26] => Mon 01 13
[27] => Mon 01 13
[28] => Mon 01 13
[29] => Mon 01 13
[30] => Mon 02 13
[31] => Mon 02 13
[32] => Mon 02 13
[33] => Mon 02 13
[34] => Mon 03 13
[35] => Tue 03 13
[36] => Tue 03 13
[37] => Tue 03 13
[38] => Tue 04 13
[39] => Tue 04 13
[40] => Tue 04 13
[41] => Tue 04 13
[42] => Tue 04 13
[43] => Tue 05 13
[44] => Tue 05 13
[45] => Tue 05 13
[46] => Tue 05 13
[47] => Tue 06 13
[48] => Tue 06 13
[49] => Tue 06 13
[50] => Tue 06 13
[51] => Tue 07 13
[52] => Tue 07 13
)
How did Monday get in there??