I'll try to explain it step by step for you.
First, you want to set up two variables that will act as counters. One for the total number of days between two dates, and one for the total number of week-end days between two dates.
$days = 0;
$weekEndDays = 0;
Next, we're going to set up some dummy variables that hold the "End Date".
$endMonth = "07";
$endDay = "29";
$endYear = "2007";
Now we're going to set up a while statement. A while statement repeats as long as the statement inside of it is true. Here's what the WHILE statement below says: take today's date in YMD format (20070727), and using the MKTIME() function, find the date in YMD format for the END DATE variables we defined above, but ALSO subtract the number of days in our DAY counter ($endDay-$days). The WHILE statement will keep executing until TODAY's DATE == END DATE-DATE COUNTER.
while(date("Ymd") != date("Ymd", mktime(0,0,0,$endMonth,($endDay-$days),$endYear))){
So, we need to add 1 to the day counter each time to WHILE loop is executed. This serves two functions: it advances the WHILE loop, bringing the END DATE 1 day closer to TODAY, and it also counts the number of times the WHILE loop has executed, which will tell us how many total days are between the two.
$days++;
Finally, we want to check to see if the current day the WHILE loop is examining is a week end. The date("w") function tells us the current week day, 0=Sunday, and 6=Saturday, so, we'll check the current day, by adding the value of the DAY counter to Today's date (date("d")+$days). If the current day's "w" value is a 0 (Sunday) or 6 (Saturday), we'll add one to the $weekEndDays counter. This will keep track of how many weekend days the WHILE loop has encountered.
if(date("w", mktime(0,0,0,date("m"),(date("d")+$days),date("Y"))) == 0 || date("w", mktime(0,0,0,date("m"),(date("d")+$days),date("Y"))) == 6){
$weekEndDays++;
}
Close the While loop.
}
//Find the total week days.
$totalWeekDays = $days-$weekEndDays;
Now, if you want to use the number of business days, just set up an If / Else statement:
if($totalWeekDays >= 5){
ECHO FORM
}
else{
ECHO REJECT
}