PHP Tutorial - PHP cal_info() Function






Definition

The cal_info() function returns information about a calendar.

Syntax

PHP cal_info() Function has the following syntax.

cal_info(calendar);

Parameter

Optional calendar indicates which calendar to get information.

  • 0 = CAL_GREGORIAN
  • 1 = CAL_JULIAN
  • 2 = CAL_JEWISH
  • 3 = CAL_FRENCH

If the calendar parameter is omitted, cal_info() returns info about all calendars.





Return

PHP cal_info() Function returns an array containing calendar elements like:

  • calname
  • calsymbol
  • month
  • abbrevmonth
  • maxdaysinmonth




Example

Get information about a calendar


<?php
print_r(cal_info(0));
?>

The code above generates the following result.

Example 2

The following code shows how to get information about the Gregorian calendar.



<?php
    print_r(cal_info(CAL_GREGORIAN));


?>

The code above generates the following result.