i have a student register for attendance, down the side will be their names, across the top i will be showing each single day (example tuesday) from three month date range
currently the code just echoes out all the Tuesdays as an array from the three month date range. i need to be able to use the individual date to add them to the database based on weather they student has attended. i know how to do this i just need to know how i can use the dates individually.
function getDatesFromRange($start, $end) {
$interval = new DateInterval('P1D');
$realEnd = new DateTime($end);
$realEnd->add($interval);
$period = new DatePeriod(
new DateTime($start),
$interval,
$realEnd
);
foreach($period as $date) {
$array[] = $date->format('Y-m-d');
}
return $array;
}
// Call the function
$dates = getDatesFromRange('2016-04-01', '2016-07-01');
// Print the output
print_r($dates);