PHP Reference

Quick Reference

The PHP cal_info() function returns information about a specified calendar, or all calendars If the calendar parameter is omitted.

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

Output

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 )

Syntax

cal_info(calendar)

Parameters

ParameterDescription
calendarSpecifies a number that indicates which calendar to return information about

  • 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

PHP Notes:

  • When using PHP, single or double quotation marks are acceptable and work identically to one another; choose whichever you prefer, and stay consistent
  • Arrays count starting from zero NOT one; so item 1 is position [0], item 2 is position [1], and item 3 is position [2] … and so on

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.