實作中使用的第一個遞迴函數

實作中使用的第一個遞迴函數,原始碼如下:

function get_lastN_period($n,$year,$month){
$year=date(“Y”,mktime(0,0,0,$month-2,1,$year));
$month=date(“n”,mktime(0,0,0,$month-2,1,$year));
if($n==1){
return array(get_preperiod_month($year,$month));
}
return array_merge(array(get_preperiod_month($year , $month)), get_lastN_period($n-1 , $year , $month));
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

Proudly using Dynamic Headers by Nicasio WordPress Design