Переделан знак зодиака на более точный

This commit is contained in:
Igor Barkov (iwork) 2020-07-03 18:46:11 +03:00
parent 70c8a6959e
commit be6b2e61da

View File

@ -2027,13 +2027,15 @@ function star_sign($date)
$zodiac[51] = "12"; $zodiac[51] = "12";
$zodiac[20] = "11"; $zodiac[20] = "11";
$zodiac[0] = "10"; $zodiac[0] = "10";
$dayOfYear = date("z", $date); $dayOfYear = (int)date("z", $date);
$isLeapYear = date("L", $date); //Высокосный? $isLeapYear = (int)date("L", $date); //Высокосный?
if ($isLeapYear && $dayOfYear >59) { if ($isLeapYear && $dayOfYear >59) {
$dayOfYear = $dayOfYear - 1; --$dayOfYear;
} }
foreach ($zodiac as $day => $sign) { foreach ($zodiac as $day => $sign) {
if ($dayOfYear > $day) break; if ($dayOfYear > $day) {
break;
}
} }
return $sign; return $sign;
} }