for ($y = 25; $y >= 7; $y--)
{
$showYear = false;
for ($m = 12; $m >= 1; $m--)
{
if (blogList($m, $y))
$showYear = true;
}
if ($showYear) {
echo '<h2>' . (2000 + $y) . '</h2>';
for ($m = 12; $m >= 1; $m--)
{
echo blogList($m, $y);
}
}
}
//blog archives
function blogList($month, $year)
{
$lastDate = array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
$beginDate = mkTime(0, 0, 0, $month, 1, $year);
$endDate = mkTime(0, 0, 0, $month, $lastDate[$month - 1], $year);
$query = .......;
}
- i don’t know why he set the
$y=25.$showYear = false; - why the
$lastDate = array(31,29,31,30,31,30,31,31,30,31,30,31);?
$y = 25is because he’s looping backwards from 2025 to 2007.$yends up as the year argument formkTime(see http://php.net/manual/en/function.mktime.php).that array holds the last date of each calendar month, e.g. January has 31 days.