【www.gdgbn.com--php常用代码】

 代码如下 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"));
?>


/*
直接循环
如果是月,则循环变量每次增加1(月)
如果是年,则每次增加12(月),
同时输出date("Y-m")或者 date("Y")

*/

本文来源:http://www.gdgbn.com/jiaocheng/24934/