Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将时隙与可用时隙进行比较_Php_Codeigniter - Fatal编程技术网

Php 将时隙与可用时隙进行比较

Php 将时隙与可用时隙进行比较,php,codeigniter,Php,Codeigniter,我已预订了8-10.00、8-8.15、8.10-8.35等时段,然后可用时段为8-8.15、8.15-8.30、8.30-8.45等。我想检查预订的时段是否没有遇到可用时段 if ( (isset($strTYm_array[$i])) && testRange($Worker_slots_times[$k], $Worker_slots_ends[$k], $strTYm_array[$i],$endTYm_array[$i])) { if ((( $Worker_s

我已预订了8-10.00、8-8.15、8.10-8.35等时段,然后可用时段为8-8.15、8.15-8.30、8.30-8.45等。我想检查预订的时段是否没有遇到可用时段

if ( (isset($strTYm_array[$i])) && testRange($Worker_slots_times[$k], $Worker_slots_ends[$k], $strTYm_array[$i],$endTYm_array[$i])) {
    if ((( $Worker_slots_ends[$k] + @$serviceBreaks[$Worker_booked_slots_ftn[$k]]) <= $endTYm) && (($Worker_slots_ends[$k]+  @$serviceBreaks[$Worker_booked_slots_ftn[$k]]+ $bk_ttime +  $duration_of_work) <= $endTYm)) {
        $strTYm_array[$i] = $Worker_slots_ends[$k] + @$serviceBreaks[$Worker_booked_slots_ftn[$k]];
        $endTYm_array[$i] = $strTYm_array[$i] + $duration_of_work + $bk_ttime;
        $endTYm_array_withoutBreak[$i] = $strTYm_array[$i] + $duration_of_work;
    } else if (isset($strTYm_array[$i])) {
        for ($s= $i; $s < count($strTYm_array); $s++ ) {
            unset($strTYm_array[$s]);
            unset($endTYm_array[$s]);
            unset($endTYm_array_withoutBreak[$s]);
        }
    }
}

function testRange ($Booked_start_time1, $booked_end_time1, $available_start_time2, $available_end_time2) {
    if ($booked_end_time1 <= $available_start_time2) {
        return true;
    } elseif ($Booked_start_time1 >= $available_start_time2 && $Booked_start_time1 >= $available_end_time2) {
        return true;
    } else {
        return false;
    }
}
if((isset($strTYm_数组[$i]))和&testRange($Worker_slots_乘以[$k],$Worker_slots_end[$k],$strTYm_数组[$i],$endTYm_数组[$i])){

如果(($Worker\u slots\u ends[$k]+@$serviceBreaks[$Worker\u booked\u slots\u ftn[$k]])我已经清理并简化了您的代码片段,但没有更改其功能。(这不是一个解决性的更改)请将您的问题包括对
testRange()的实际调用
。这样我们可以看到每个变量/参数中值的准确质量。谢谢@mickmackusa你能帮我排序吗issue@mickmackusa更新代码。请查看我的观点是,志愿者无法自信地测试您的代码片段和他们自己的测试,因为他们不知道
$Worker\u slots\u时间的确切值[$k]
$Worker\u slots\u ends[$k]
$strTYm\u array[$i]
$endTYm\u array[$i]
然后你可以编辑你的问题来创建一个,然后发布一个教育性的解决答案;或者你可以更简单地收回/删除你的问题。