value as follows: // key: the index of the repeating value; and // value: the repeating value (date) $existingHolidays = array_intersect($allDates, $holidays); // remove/delete the official holidays from the $allDates array // array_search() searches the array for a given value // Returns the corresponding key if successful foreach ($existingHolidays as $holiday => $date): $index = array_search($date, $allDates); if($index !== FALSE): unset($allDates[$index]); endif; endforeach; // check which of the remaining days are weekdays foreach ($allDates as $dateIndex => $date): if (isWeekend($date)): unset($allDates[$dateIndex]); endif; endforeach; // printing the result if (sizeof($allDates) > 0): echo "
    "; foreach ($allDates as $workingDay): echo "
  1. $workingDay
  2. "; endforeach; echo "
"; else: echo "

No workdays

"; endif; // the 'N' parameter takes values from 1 (for Monday) through 7 (for Sunday) function isWeekend($date) { return (date('N', strtotime($date)) >= 6); } ?>