I have a problem using PHP to get the finish date of course, as below:
Inputs:
8/23/2019
)Monday, Tuesday, Friday
)8
)Output: The finish date of course (is 9/9/2019
with above e.g inputs).
One lesson is one day. Input fields from end user:
Sorry for my bad English. Thank you very much!
As I see it loop while there are lessons left and subtract when it's Monday, Tuesday or Friday.
After the loop output the date.
$start = "8/23/2019";
$days = ["Monday", "Tuesday", "Friday"];
$n = 8;
$d = strtotime($start);
while($n>0){
//See if day is in days array
if(in_array(date("l", $d), $days)){
$n--;
}
$d += 86400; // go to next day
}
echo date("m/d/Y", $d-86400); //-86400 because the loop adds one at the end.