This will convert given Hijri date (Islamic calendar) into Julian day

@param integer $year  Hijri year
@param integer $month Hijri month
@param integer $day   Hijri day

@return integer Julian day
@author Khaled Al-Sham'aa <khaled@ar-php.org>
435577
protected function islamicToJd($year, $month, $day)
    {
        $jd = (int)((11 * $year + 3) / 30) + (int)(354 * $year) + (int)(30 * $month) 
            - (int)(($month - 1) / 2) + $day + 1948440 - 385;
        return $jd;
    }
927718
public function showMonth($year, $month)
    {
        if (null !== $this->partial) {
            $partial = $this->view->plugin('partial');

            $params = array(
                'calendar' => $this->calendar,
                'startDay' => $this->startDay,
                'year'     => $year,
                'month'    => $month,
            );

            return $partial($this->partial, $params);
        }

        $renderer = $this->getRenderer();

        $renderer->setCalendar($this->calendar);
        $renderer->setStartDay($this->startDay);

        return $renderer->renderMonth($year, $month);
    }
1314760
private function getDaysInMonth(Month $month, Year $year)
    {
        return (int)date('t', mktime(0, 0, 0, (string)$month, 1, (string)$year));
    }
1033771
public static function of(int $month, int $day) : MonthDay
    {
        Field\MonthOfYear::check($month);
        Field\DayOfMonth::check($day, $month);

        return new MonthDay($month, $day);
    }
828991
public function setDate($year, $month, $day) {
        
        $this->setYear((int) $year);
        $this->setMonth((int) $month);
        $this->setDay((int) $day);
        
        $this->updateGeorgianFromJalali();
        
        return $this;
    }
781916
public function jdToYmd($julian_day)
    {
        // Find the year, by adding one month at a time to use up the remaining days.
        $year  = $this->jdToY($julian_day);
        $month = 1;
        $day   = $julian_day - $this->yToJd($year) + 1;

        while ($day > $this->daysInMonth($year, $month)) {
            $day -= $this->daysInMonth($year, $month);
            $month++;
        }

        // PHP 5.4 and earlier converted non leap-year Adar into month 6, instead of month 7.
        $month -= ($month === 7 && $this->options[self::EMULATE_BUG_54254] && !$this->isLeapYear($year)) ? 1 : 0;

        return array($year, $month, $day);
    }
1328745
private function isDateValid(int $year, int $month, int $day) : bool
    {
        if ($day === 0) {
            return false;
        }

        switch ($month) {
            case 2:
                $days = $this->isLeapYear($year) ? 29 : 28;
                break;

            case 4:
            case 6:
            case 9:
            case 11:
                $days = 30;
                break;

            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                $days = 31;
                break;

            default:
                return false;
        }

        return $day <= $days;
    }
742775
function mstart($month,$day,$year)

	{

		list( $jyear, $jmonth, $jday ) = $this->gregorian_to_jalali($year, $month, $day);

		list( $year, $month, $day ) = $this->jalali_to_gregorian($jyear, $jmonth, "1");

		$timestamp=mktime(0,0,0,$month,$day,$year);

		return date("w",$timestamp);

	}
1073576
protected static function julian2jalali($julianDayNumber) {
        
        $gYear  = self::julian2georgian($julianDayNumber)[0];
        $year   = $gYear - static::HEGIRA_STARTING_YEAR;
        $parsed = self::parseJalali($year);
        $jdn1f  = self::georgian2julian($gYear, 3, $parsed['march']);
        
        // Find number of days that passed since 1 Farvardin.
        $passed = $julianDayNumber - $jdn1f;
        
        if ($passed >= 0) {
            if ($passed <= 185) {
                $month = 1 + self::division($passed, 31);
                $day   = ($passed % 31) + 1;
                
                return [$year, $month, $day];
            } else {
                $passed -= 186;
            }
        } else {
            $year   -= 1;
            $passed += 179;
            
            if ($parsed['leap'] === 1) {
                $passed += 1;
            }
        }
        
        $month = 7 + self::division($passed, 30);
        $day   = ($passed % 30) + 1;
        
        return [$year, $month, $day];
    }
912647
public function withDateAt(int $year = null, int $month = null, int $day = null) : self
    {
        if (null === $year && null === $month && null === $day) {
            return $this;
        }
        
        $year  = $year === null ? $this->year() : $year;
        $month = $month ?: $this->month();
        $day   = $day   ?: $this->day();
        
        $instance = clone $this;
        
        $instance->date->setDate($year, $month, $day);
        
        return $instance;
    }
556880
public function calendarMonthsInYear(string $calendar, int $year): array
    {
        $date          = new Date($calendar . ' ' . $year);
        $calendar_date = $date->minimumDate();
        $month_numbers = range(1, $calendar_date->monthsInYear());
        $month_names   = [];

        foreach ($month_numbers as $month_number) {
            $calendar_date->day   = 1;
            $calendar_date->month = $month_number;
            $calendar_date->setJdFromYmd();

            if ($month_number === 6 && $calendar_date instanceof JewishDate && !$calendar_date->isLeapYear()) {
                // No month 6 in Jewish non-leap years.
                continue;
            }

            if ($month_number === 7 && $calendar_date instanceof JewishDate && !$calendar_date->isLeapYear()) {
                // Month 7 is ADR in Jewish non-leap years (and ADS in others).
                $mon = 'ADR';
            } else {
                $mon = $calendar_date->format('%O');
            }

            $month_names[$mon] = $calendar_date->format('%F');
        }

        return $month_names;
    }
1009541
public static function checkBirthDate($day, $month, $year) {
        if (empty($day) || empty($month) || empty($year))
            return false;

        return checkdate($month, $day, $year);
    }
1047889
public function convertGregorianToJd($year, $month, $day)
    {
        // Special case mapping 0/0/0 -> 0
        if ($year == 0 || $month == 0 || $day == 0) {
            return 0;
        }

        $m1412 = ($month <= 2) ? - 1 : 0;
        return floor((1461 * ($year + 4800 + $m1412)) / 4) + floor((367 * ($month - 2 - 12 * $m1412)) / 12) -
             floor((3 * floor(($year + 4900 + $m1412) / 100)) / 4) + $day - 32075;
    }
620251
public function jdToYmd($julian_day)
    {
        $year  = (int) ((30 * ($julian_day - 1948440) + 10646) / 10631);
        $month = (int) ((11 * ($julian_day - $year * 354 - (int) ((3 + 11 * $year) / 30) - 1948086) + 330) / 325);
        $day   = $julian_day - 29 * ($month - 1) - (int) ((6 * $month - 1) / 11) - $year * 354 - (int) ((3 + 11 * $year) / 30) - 1948085;

        return array($year, $month, $day);
    }
604717
public static function createJalaliDate($year = null, $month = null, $day = null, $timezone = null)
    {
        return static::createJalali($year, $month, $day, null, null, null, $timezone);
    }
242847
public static function convertToGregorian(int $day, int $month, int $year, int $adjustment = null)
    {
        return static::toGregorian($day, $month, $year, static::getAdjustment($adjustment));
    }
42659
public static function numberOfDaysInMonth($month = 0, $year = 0)
    {
        if ($month < 1 or $month > 12) {
            return 0;
        }

        if (!is_numeric($year) or strlen($year) != 4) {
            $year = date('Y');
        }

        if ($month == 2) {
            if ($year % 400 == 0 or ($year % 4 == 0 and $year % 100 != 0)) {
                return 29;
            }
        }

        $days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

        return $days_in_month[$month - 1];
    }