Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/DateTime.php
public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs)
    {
        //    Retrieve the mandatory start and end date that are referenced in the function definition
        $startDate = Functions::flattenSingleValue($startDate);
        $endDate = Functions::flattenSingleValue($endDate);
        //    Get the optional days
        $dateArgs = Functions::flattenArray($dateArgs);

        //    Validate the start and end dates
        if (is_string($startDate = $sDate = self::getDateValue($startDate))) {
            return Functions::VALUE();
        }
        $startDate = (float) floor($startDate);
        if (is_string($endDate = $eDate = self::getDateValue($endDate))) {
            return Functions::VALUE();
        }
        $endDate = (float) floor($endDate);

        if ($sDate > $eDate) {
            $startDate = $eDate;
            $endDate = $sDate;
        }

        // Execute function
        $startDoW = 6 - self::WEEKDAY($startDate, 2);
        if ($startDoW < 0) {
            $startDoW = 0;
        }
        $endDoW = self::WEEKDAY($endDate, 2);
        if ($endDoW >= 6) {
            $endDoW = 0;
        }

        $wholeWeekDays = floor(($endDate - $startDate) / 7) * 5;
        $partWeekDays = $endDoW + $startDoW;
        if ($partWeekDays > 5) {
            $partWeekDays -= 5;
        }

        //    Test any extra holiday parameters
        $holidayCountedArray = [];
        foreach ($dateArgs as $holidayDate) {
            if (is_string($holidayDate = self::getDateValue($holidayDate))) {
                return Functions::VALUE();
            }
            if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
                if ((self::WEEKDAY($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
                    --$partWeekDays;
                    $holidayCountedArray[] = $holidayDate;
                }
            }
        }

        if ($sDate > $eDate) {
            return 0 - ($wholeWeekDays + $partWeekDays);
        }

        return $wholeWeekDays + $partWeekDays;
    }
public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs)
    {
        //    Retrieve the mandatory start and end date that are referenced in the function definition
        $startDate = Functions::flattenSingleValue($startDate);
        $endDate = Functions::flattenSingleValue($endDate);
        //    Get the optional days
        $dateArgs = Functions::flattenArray($dateArgs);

        //    Validate the start and end dates
        if (is_string($startDate = $sDate = self::getDateValue($startDate))) {
            return Functions::VALUE();
        }
        $startDate = (float) floor($startDate);
        if (is_string($endDate = $eDate = self::getDateValue($endDate))) {
            return Functions::VALUE();
        }
        $endDate = (float) floor($endDate);

        if ($sDate > $eDate) {
            $startDate = $eDate;
            $endDate = $sDate;
        }

        // Execute function
        $startDoW = 6 - self::WEEKDAY($startDate, 2);
        if ($startDoW < 0) {
            $startDoW = 0;
        }
        $endDoW = self::WEEKDAY($endDate, 2);
        if ($endDoW >= 6) {
            $endDoW = 0;
        }

        $wholeWeekDays = floor(($endDate - $startDate) / 7) * 5;
        $partWeekDays = $endDoW + $startDoW;
        if ($partWeekDays > 5) {
            $partWeekDays -= 5;
        }

        //    Test any extra holiday parameters
        $holidayCountedArray = [];
        foreach ($dateArgs as $holidayDate) {
            if (is_string($holidayDate = self::getDateValue($holidayDate))) {
                return Functions::VALUE();
            }
            if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
                if ((self::WEEKDAY($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
                    --$partWeekDays;
                    $holidayCountedArray[] = $holidayDate;
                }
            }
        }

        if ($sDate > $eDate) {
            return 0 - ($wholeWeekDays + $partWeekDays);
        }

        return $wholeWeekDays + $partWeekDays;
    }
public static function NETWORKDAYS ( $ startDate , $ endDate , ... $ dateArgs ) { //    Retrieve the mandatory start and end date that are referenced in the function definition $ startDate = Functions :: flattenSingleValue ( $ startDate ) ; $ endDate = Functions :: flattenSingleValue ( $ endDate ) ; //    Get the optional days $ dateArgs = Functions :: flattenArray ( $ dateArgs ) ; //    Validate the start and end dates if ( is_string ( $ startDate = $ sDate = self :: getDateValue ( $ startDate ) ) ) { return Functions :: VALUE ( ) ; } $ startDate = ( float ) floor ( $ startDate ) ; if ( is_string ( $ endDate = $ eDate = self :: getDateValue ( $ endDate ) ) ) { return Functions :: VALUE ( ) ; } $ endDate = ( float ) floor ( $ endDate ) ; if ( $ sDate > $ eDate ) { $ startDate = $ eDate ; $ endDate = $ sDate ; } // Execute function $ startDoW = 6 - self :: WEEKDAY ( $ startDate , 2 ) ; if ( $ startDoW < 0 ) { $ startDoW = 0 ; } $ endDoW = self :: WEEKDAY ( $ endDate , 2 ) ; if ( $ endDoW >= 6 ) { $ endDoW = 0 ; } $ wholeWeekDays = floor ( ( $ endDate - $ startDate ) / 7 ) * 5 ; $ partWeekDays = $ endDoW + $ startDoW ; if ( $ partWeekDays > 5 ) { $ partWeekDays -= 5 ; } //    Test any extra holiday parameters $ holidayCountedArray = [ ] ; foreach ( $ dateArgs as $ holidayDate ) { if ( is_string ( $ holidayDate = self :: getDateValue ( $ holidayDate ) ) ) { return Functions :: VALUE ( ) ; } if ( ( $ holidayDate >= $ startDate ) && ( $ holidayDate <= $ endDate ) ) { if ( ( self :: WEEKDAY ( $ holidayDate , 2 ) < 6 ) && ( ! in_array ( $ holidayDate , $ holidayCountedArray ) ) ) { -- $ partWeekDays ; $ holidayCountedArray [ ] = $ holidayDate ; } } } if ( $ sDate > $ eDate ) { return 0 - ( $ wholeWeekDays + $ partWeekDays ) ; } return $ wholeWeekDays + $ partWeekDays ; }
NETWORKDAYS.

Returns the number of whole working days between start_date and end_date. Working days
exclude weekends and any dates identified in holidays.
Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days
worked during a specific term.

Excel Function:
NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]])

@category Date/Time Functions

@param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
PHP DateTime object, or a standard date string
@param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
PHP DateTime object, or a standard date string

@return int Interval between the dates
NETWORKDAYS .