PHP cal_info() 函数

定义和用法

cal_info() 函数返回一个数组,其中包含了关于给定历法的信息。

所返回的数组包含这些元素:calname, calsymbol, month, abbrevmonth 以及 maxdaysinmonth。

语法

cal_from_jd(jd,calendar)
参数 描述
calendar

必需。规定要使用的历法。可以使用下面这些常量:

  • CAL_GREGORIAN
  • CAL_JULIAN
  • CAL_JEWISH
  • CAL_FRENCH

提示和注释

提示:在 PHP 5 中,如果没有指定 calendar 参数,则返回所有被支持的历法的信息。

例子

<?php
$calinfo=cal_info(0);
print_r($calinfo);
?>

输出:

Array
(
[months] => Array
(
[1] => January
[2] => February
[3] => March
[4] => April
[5] => May
[6] => June
[7] => July
[8] => August
[9] => September
[10] => October
[11] => November
[12] => December
)

[abbrevmonths] => Array
(
[1] => Jan
[2] => Feb
[3] => Mar
[4] => Apr
[5] => May
[6] => Jun
[7] => Jul
[8] => Aug
[9] => Sep
[10] => Oct
[11] => Nov
[12] => Dec
)

[maxdaysinmonth] => 31
[calname] => Gregorian
[calsymbol] => CAL_GREGORIAN
)
成品网站超市图标