Home >Backend Development >PHP Tutorial >PHP generates a drop-down list of years, quarters, and months since the specified time_PHP Tutorial
php tutorial generates a drop-down list of year, quarter and month since the specified time
function countSeason($start,$end){
$temp = date("Y-m",strtotime( "$start +3month"));
while ($temp <= $end){
$time[] = $temp;
$temp = date("Y-m",strtotime("$ temp +3month"));
}
return $time;
}
$time = countSeason("2008-10",date("Y-m"));
?>
/*
Loop directly
If it is a month, the loop variable will increase by 1 (month) each time
If it is a year, it will increase by 12 (month) each time,
At the same time, output date('Y -m') or date('Y')
*/