Judgment of overlapping regions of multiple time periods in php

$times=[
0=>"08:00-09:00"
1=>"09:20-13:00"
2=>"14:00-18:00"
3=>"19:00-20:00"
];

there are a large number of such time arrays, all of which are reservation information. Now that the customer has selected an appointment time, I want to determine whether there is any overlap between the given time and the one already booked. For example, if you give 08:30-10 time 00, then this time will partially overlap with $time [0] and $time [1]. My practice is to sort the array I have booked at 70 points, and use foreach to traverse it. If there is an overlap, I will output the first time segment with overlap, but I think there may be a better solution. The time period is like a line with a start and end point. I project all the time periods onto the x-axis. You can tell where there is overlap at a moment"s notice. Can you give me a specific method? Thank you.

clipboard.png

Php
Nov.09,2021

//
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ee47-4148f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ee47-4148f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?