cal_days_in_month
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
cal_days_in_month — 返回某個曆法中某年中某月的天數
說明
cal_days_in_month(int
$calendar
, int $month
, int $year
): int
該函式返回特定曆法
中的某年
中的某月
的天數。
參數
-
calendar
-
用來計算的某個曆法
-
month
-
選定曆法中的某月
-
year
-
選定曆法中的某年
返回值
指定曆法中選定的某月的天數。
範例
示例 #1 cal_days_in_month() example
<?php
$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003); // 31
echo "There was $num days in August 2003";
?>