php get the number of days of the current month

<?php
    //php获取当前月份的所有天数
    $start_day = date('Ym01', time());
    $end_day   = date('Ymd', strtotime("{$start_day} + 1 month -1 day"));

    

    $range_date = range(strtotime($start_day), strtotime($end_day), 24*3600);

    $func = function ($value) {
        return date('Ymd', $value);
    };

    $date = array_map($func, $range_date);

    var_dump($date);

  

Guess you like

Origin www.cnblogs.com/zhangxiaoj/p/11291705.html