} $matches = array_reverse($matches); foreach ($matches as $k => $value) { shuffle($courts); if ($matches[$k + 1]) { Scheduling::nextLevelMatch($event_id, $tour_id, $matches[$k]['id'], $matches[$k + 1]['id'], $courts[0], $allocate_time1, $y, $winner_bracket); } } $loss_bracket_matches = array_reverse($loss_bracket_matches); $matches_wb_next = array_reverse($matches_wb_next); if (count($matches_wb_next) > 1) { $match_array = array_merge_recursive($loss_bracket_matches, $matches_wb_next); } else { $match_array = $loss_bracket_matches; } Scheduling::PhaseSeparation($event_id, $tour_id, $match_array, $courts, $y); // foreach ($loss_bracket_matches as $k => $value) { // shuffle($courts); // //if($loss_bracket_matches[$k+1]) // Scheduling::nextLevelMatch($event_id,$tour_id,$value['id'],$loss_bracket_matches[$k+1]['id'],$courts[0],$allocate_time1,$y,$loser_bracket); // } // if($y>3){ // $matches_wb_next=array_reverse($matches_wb_next); // foreach($matches_wb_next as $k => $value){ // shuffle($courts); // //if($matches_wb[$k+1]) // Scheduling::nextLevelMatch($event_id,$tour_id,$matches_wb_next[$k]['id'],$matches_wb_next[$k+1]['id'],$courts[0],$allocate_time1,$y,$loser_bracket); // } // } } $penultimate_game = Scheduling::getFinalGame($tour_id, $event_id);