gpt4 book ai didi

php - hhvm 中的复活节日期函数

转载 作者:可可西里 更新时间:2023-11-01 00:42:20 24 4
gpt4 key购买 nike

我发现 hhvm 不支持 easter_date() 函数。

http://docs.hhvm.com/manual/en/function.easter-date.php

有替代方案吗?我需要使用此功能或等效功能,我还想使用 HHVM。

谢谢

最佳答案

您可以实现 easter_date 函数背后的算法:

if (!function_exists('easter_date')) {
function easter_date($year) {
/*
G is the Golden Number-1
H is 23-Epact (modulo 30)
I is the number of days from 21 March to the Paschal full moon
J is the weekday for the Paschal full moon (0=Sunday,
1=Monday, etc.)
L is the number of days from 21 March to the Sunday on or before
the Paschal full moon (a number between -6 and 28)
*/


$G = $year % 19;
$C = (int)($year / 100);
$H = (int)($C - (int)($C / 4) - (int)((8*$C+13) / 25) + 19*$G + 15) % 30;
$I = (int)$H - (int)($H / 28)*(1 - (int)($H / 28)*(int)(29 / ($H + 1))*((int)(21 - $G) / 11));
$J = ($year + (int)($year/4) + $I + 2 - $C + (int)($C/4)) % 7;
$L = $I - $J;
$m = 3 + (int)(($L + 40) / 44);
$d = $L + 28 - 31 * ((int)($m / 4));
$y = $year;
$E = mktime(0,0,0, $m, $d, $y);

return $E;
}
}

这是一个 PHP implementationGauss algorithm .

关于php - hhvm 中的复活节日期函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31828005/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com