Display the number of days after March 21 that Easter Sunday falls/fell on for various years.
<?php echo “Easter Day is “. easter_days() . ” days after March 21 this year.<br />”; echo “Easter Day was “. easter_days(1990) . ” days after March 21 in 1990.<br />”; echo “Easter Day was “. easter_days(1342) . ” days after March 21 in 1342.<br />”; echo “Easter Day will be “. easter_days(2050) . ” days after March 21 in 2050.”; ?> |
The easter_days() function returns the number of days after March 21 that Easter Sunday occurs in a given year.
Tip: Easter Sunday is defined as the Sunday following the first full moon that occurs on or after the Spring Equinox (March 21).
easter_days(year,method); |
Parameter |
Description |
year |
(Optional) Specifies the year as a number. If not provided, the default is the current year according to local time. |
method |
(Optional) Allows for calculating Easter dates based on different calendars. For example, setting it to CAL_EASTER_ROMAN uses the Gregorian calendar for the years 1582 to 1752. |
Return Value: |
Returns the number of days after March 21 that Easter Sunday falls in the specified year. |
PHP Version: |
4+ |
Changelog: |
Starting with PHP 4.3, the year parameter became optional, and a method parameter was introduced. |