function getLeapMonthOffset($a11, $timeZone) { $k = INT(($a11 - 2415021.076998695) / 29.530588853 + 0.5); $last = 0; $i = 1; // We start with the month following lunar month 11 $arc = getSunLongitude(getNewMoonDay($k + $i, $timeZone), $timeZone); do { $last = $arc; $i = $i + 1; $arc = getSunLongitude(getNewMoonDay($k + $i, $timeZone), $timeZone); } while ($arc != $last && $i < 14); return $i - 1; }
/** * getLeapMonthOffset() * * @param mixed $a11 * @param mixed $timeZone * @return */ function getLeapMonthOffset($a11, $timeZone) { $k = floor(($a11 - 2415021.076998695) / 29.530588853 + 0.5); $last = 0; $i = 1; $arc = getSunLongitude(getNewMoonDay($k + $i, $timeZone), $timeZone); do { $last = $arc; $i = $i + 1; $arc = getSunLongitude(getNewMoonDay($k + $i, $timeZone), $timeZone); } while ($arc != $last && $i < 14); return $i - 1; }