I like need to get the opposite dates. Currently, those date are unavailable dates. I need to get the available dates.
This is what I wrote, it works but there's a part I don't know how to get the value of the user.
PHP Code:
// Function to give a list of personnel who are able to serve the duty for the particular month
// Some might not be able to make it due to medical reason, off, leave, roving and/or other reason.
function availableList(&$DB, $unavailableDate, $month) {
// Determine the number of days in the particular month and year
$year = getdate();
$num = cal_days_in_month(CAL_GREGORIAN, $month, $year['year']);
$temp_availableDate = array();
for ($i=1; $i<=$num; $i++) {
if (!in_array($year['year'].'-'.$month.'-'.$i, $unavailableDate)) {
$temp_availableDate[] = $year['year'].'-'.$month.'-'.$i;
}
}
return $temp_availableDate;
}
// This I type it out myself. If I wanted to use the name from the previous array? // How do I call it? It's $personnelDates[$arr[$i]['personnel_name']] but that's
// the date.
availableList($DB, $personnelDates['Tan Ah Lian'], '04');
PS: After some thought, would it be better not to do this function? When I'm doing the script, I will just add in the codes for it.