Getting all the dates in a month that do not coincide with a project's dates
My attempt to make this code as clean as possible.
Note that i have not changed almost any of the logic you provided. 

&lt;?php

class ProjectDays {
    private $projectDays;

    public function __construct(array $projectDays, $month, $year) {
        $this-&gt;projectDays = $projectDays;
        $this-&gt;month = $month;
        $this-&gt;year = $year;
    }

    public function getNonProjectDays() {
        $monthDays = array();
        $projectDays = array();
        $daysInMonth = $this-&gt;getDaysInMonth();
        foreach ($this-&gt;projectDays as $projectDay) {
            for ($day = 1; $day &lt;= $daysInMonth; $day++) {
                $date = $this-&gt;formatDate($day);
                $monthDays[$day] = $date;
                $weekDay = $this-&gt;getWeekDay($date);
                if($weekDay == $projectDay){
                    $projectDays[] = $date;
                }
            }
        }
        return array_diff($monthDays, $projectDays);
    }

    private function getWeekDay($date) {
        return date('N', strtotime($date));
    }

    private function getDaysInMonth() {
        return cal_days_in_month(CAL_GREGORIAN, $this-&gt;month, $this-&gt;year);
    }

    private function formatDate($day) {
        return "{$this-&gt;year}-{$this-&gt;month}-{$day}";
    }
}

$excludedDays = new ProjectDays([1, 6], date('n'), date('Y'));

print_r($excludedDays-&gt;getNonProjectDays());