easter_days
Description
The easter_days of Calendar for PHP gets the number of days after March 21 on which Easter falls for a given year.
Syntax
easter_days( ?int $year = null, int $mode = CAL_EASTER_DEFAULT ): int
Parameters
year
The year as a positive number. If omitted, defaults to the current year according to the local time.
method
Allows Easter dates to be calculated based on a specified calendar.
Value | Constant | Description |
---|---|---|
0 | CAL_EASTER_DEFAULT | Calculate Easter for years before 1753 according to the Julian calendar and for later years according to the Gregorian calendar. |
1 | CAL_EASTER_ROMAN | Calculate Easter for years before 1583 according to the Julian calendar and for later years according to the Gregorian calendar. |
2 | CAL_EASTER_ALWAYS_GREGORIAN | Calculate Easter according to the proleptic Gregorian calendar. |
3 | CAL_EASTER_ALWAYS_JULIAN | Calculate Easter according to the Julian calendar. |
Return
Returns the number of days after March 21st that the Easter Sunday is in the given year.
Examples
1 · Jesus
<? echo "\"Don't be alarmed,\" he said. \"You are looking for Jesus the Nazarene, who was crucified. He has risen! He is not here. See the place where they laid him. Mark 16:6"; echo "\n\n<br><br>Jesus, who lived a perfect life, died for our sins. He rose from the grave and offers us eternal life with Him in heaven. All we have to do is confess Jesus is Lord and believe God raised Him from the dead and we will be saved. Happy Easter!";
"Don't be alarmed," he said. "You are looking for Jesus the Nazarene, who was crucified. He has risen! He is not here. See the place where they laid him. Mark 16:6 <br><br>Jesus, who lived a perfect life, died for our sins. He rose from the grave and offers us eternal life with Him in heaven. All we have to do is confess Jesus is Lord and believe God raised Him from the dead and we will be saved. Happy Easter!
2 · void
<? $return = easter_days(); echo $return;
10
3 · year
<? $year = 1; $return = easter_days($year); echo $return;
6
4 · method · CAL_EASTER_DEFAULT
<? $year1 = 1582; $year2 = 1583; $year3 = 1752; $year4 = 1753; $method = CAL_EASTER_DEFAULT; $return1 = easter_days($year1, $method); $return2 = easter_days($year2, $method); $return3 = easter_days($year3, $method); $return4 = easter_days($year4, $method); echo "$year1: $return1\n"; echo "$year2: $return2\n"; echo "$year3: $return3\n"; echo "$year4: $return4";
1582: 25 1583: 10 1752: 8 1753: 32
5 · method · CAL_EASTER_ROMAN
<? $year1 = 1582; $year2 = 1583; $year3 = 1752; $year4 = 1753; $method = CAL_EASTER_ROMAN; $return1 = easter_days($year1, $method); $return2 = easter_days($year2, $method); $return3 = easter_days($year3, $method); $return4 = easter_days($year4, $method); echo "$year1: $return1\n"; echo "$year2: $return2\n"; echo "$year3: $return3\n"; echo "$year4: $return4";
1582: 25 1583: 20 1752: 12 1753: 32
6 · method · CAL_EASTER_ALWAYS_GREGORIAN
<? $year1 = 1582; $year2 = 1583; $year3 = 1752; $year4 = 1753; $method = CAL_EASTER_ALWAYS_GREGORIAN; $return1 = easter_days($year1, $method); $return2 = easter_days($year2, $method); $return3 = easter_days($year3, $method); $return4 = easter_days($year4, $method); echo "$year1: $return1\n"; echo "$year2: $return2\n"; echo "$year3: $return3\n"; echo "$year4: $return4";
1582: 28 1583: 20 1752: 12 1753: 32
7 · method · CAL_EASTER_ALWAYS_JULIAN
<? $year1 = 1582; $year2 = 1583; $year3 = 1752; $year4 = 1753; $method = CAL_EASTER_ALWAYS_JULIAN; $return1 = easter_days($year1, $method); $return2 = easter_days($year2, $method); $return3 = easter_days($year3, $method); $return4 = easter_days($year4, $method); echo "$year1: $return1\n"; echo "$year2: $return2\n"; echo "$year3: $return3\n"; echo "$year4: $return4";
1582: 25 1583: 10 1752: 8 1753: 21