public static function jdToJewish($julian_day, $hebrew, $fl)
    {
        if ($hebrew) {
            if ($julian_day < 347998 || $julian_day > 4000075) {
                $error_msg = PHP_VERSION_ID < 70200 ? 'Year out of range (0-9999).' : 'Year out of range (0-9999)';

                return trigger_error($error_msg, E_USER_WARNING);
            }

            return self::$jewish_calendar->jdToHebrew(
                $julian_day,
                (bool)($fl & CAL_JEWISH_ADD_ALAFIM_GERESH),
                (bool)($fl & CAL_JEWISH_ADD_ALAFIM),
                (bool)($fl & CAL_JEWISH_ADD_GERESHAYIM)
            );
        } else {
            // The upper limit is hard-coded into PHP to prevent numeric overflow on 32 bit systems.
            return self::jdToCalendar(self::$jewish_calendar, $julian_day, 347998, 324542846);
        }
    }