How to get the date of Easter in PHP?

If PHP is compiled with --enable-calendar, you can use easter_date(): http://php.net/manual/en/function.easter-date.php

if (time() <= easter_date(2017)) {
    echo 'HaPHPy Easter!';
}

and easter_days(): http://php.net/manual/en/function.easter-days.php

The computation of the date of Easter can also be done manually.



Found a typo? Something wrong with this content?

Just fork and edit it.

Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all contributors.