how to get the number of days of the current month? in PHP

后端 未结 11 2081
悲哀的现实
悲哀的现实 2021-02-12 03:35

i want to check if today is the last day of the month, but i don\'t really know how. i want to write it in php.

can you help?

thanks, Sebastian

11条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-12 04:23

    And here it is, wrapped up as a function:

    function is_last_day_of_month($timestamp = NULL) {
        if(is_null($timestamp))
            $timestamp = time();
        return date('t', $timestamp) == date('j', $timestamp);
    }
    

提交回复
热议问题