note 14042 added to function.easter-date.php

From: Date: Sat, 14 Jul 2001 15:43:04 +0000
Subject: note 14042 added to function.easter-date.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15375@lists.php.net to get a copy of this message
If for a reason your server does not support this (mind didn't and they wouln't upgrade) you can do the following. It's kind of a big hack. $y = date("Y"); $value = substr(strstr(($y / 19), '.'), 1, 3); // Do the calculation if($value == "") { $value = "000"; // Keep things simple. } $match = array("000","052","105","157","210","263","315","368","421","473","526","578","631","684","736","789","842","894","947"); // Mini-Database if($y >= 1900 && $y <= 2199) { $month = array("Apr","Apr","Mar","Apr","Mar","Apr","Apr","Mar","Apr","Apr","Mar","Apr","Apr","Mar","Apr","Mar","Apr","Apr","Mar"); $day = array("14","3","23","11","31","18","8","28","16","5","25","13","2","22","10","30","17","7","27"); } elseif(($y >= 2200 && $y <= 2299) || ($y >= 2400 && $y <= 2499)) { $month = array("Apr","Apr","Mar","Apr","Apr","Mar","Apr","Mar","Apr","Apr","Mar","Apr","Apr","Mar","Apr","Mar","Apr","Apr","Mar"); $day = array("15","4","24","12","1","21","9","29","17","6","26","14","3","23","11","31","18","8","28"); } elseif(($y >= 2300 && $y <= 2399) || ($y >= 2500 && $y <= 2599)) { $month = array("Apr","Apr","Mar","Apr","Apr","Mar","Apr","Mar","Apr","Apr","Mar","Apr","Apr","Mar","Apr","Apr","Mar","Apr","Mar"); $day = array("16","5","25","13","2","22","10","30","18","7","27","15","4","24","12","1","21","9","29"); } for ($i=0;$i<sizeof($match);$i++) { if (strstr($value,$match[$i])) { $day = $day[$i] + 7; // Got Paschal Full Moon and we add 7 for next sunday. print $month[$i] . "|" . $day; // Print the Month and date. } } http://www.php.net/manual/en/function.easter-date.php

« previous php.notes (#15375) next »