Returns an array composed of the months. The copy code is as follows: *** generate the array of months from the start month to the end month * this method is modeled by the getDateArr () method * @ paramunknown_type $ start * @ paramunknown_type
The code is as follows:
/**
* Generates an array of months from the start month to the end month.
* This method is similar to the getDateArr () method of party Zihao.
* @ Param unknown_type $ start
* @ Param unknown_type $ end
*/
Function getMonthArr ($ start, $ end)
{
$ Start = empty ($ start )? Date ('Y-M', strtotime ('-1 month'): $ start;
$ End = empty ($ end )? Date ('Y-M'): $ end;
// Convert to timestamp
$ St = strtotime ($ start. '-01 ');
$ Et = strtotime ($ end. '-01 ');
$ T = $ st;
$ I = 0;
While ($ t <= $ et)
{
// Formula for calculating the total number of seconds accumulated here: the timestamp number of seconds in the previous month minus the timestamp number of the current month
// Do not understand what you want to do
$ D [$ I] = trim (date ('Y-M', $ t ),'');
$ T + = strtotime ('+ 1 month', $ t)-$ t;
$ I ++;
}
Return $ d;
}
The http://www.bkjia.com/PHPjc/325458.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325458.htmlTechArticle code is as follows:/*** generate the array of months from the start month to the end month * this method is modeled after party Zi Hao getDateArr () METHOD * @ param unknown_type $ start * @ param unknown_type...