am trying to write a function to find freetime slots during working hours 8 - 17hrs
can anyone help with an algorithm please
Can anyone read this array using its index
{
"starttime": "07:30",
"endtime": "08:30"
},
{
"starttime": "11:00",
"endtime": "11:30"
},
{
"starttime": "14:00",
"endtime": "15:00"
}
]
forexample
for ($i = 0; $i < count($value); $i++) {
$free = array();
if ($value[$i]["starttime"] > $start_time) {
$free['starttime'] = $start_time;
$free['endtime'] = $value[$i]["starttime"];
} else {
if ($value[$i]["endtime"] > $start_time) {
$free['starttime'] = $value[$i]["endtime"];
$free['endtime'] = $value[$i + 1]["starttime"];
} else {
$free['starttime'] = $start_time;
$free['endtime'] = $value[$i + 1]["starttime"];
}
}
array_push($freetimes["free"], $freetimes);
}
this way is not possible its not returning any result