function checkFinalDay($year,$month){
    $finalDay = [
        "1" => 31,
        "2" => 28,
        "3" => 31,
        "4" => 30,
        "5" => 31,
        "6" => 30,
        "7" => 31,
        "8" => 31,
        "9" => 30,
        "10" => 31,
        "11" => 30,
        "12" => 31,
    ];
    if( $year%4 == 0 && $year%100 != 0 || $year%400 == 0 {
        $finalDay["2"] = 29;
    }
    return $finalDay[$month];
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme