Test if a range intersects another range of numbers
问题 I have 2 range of numbers: $startTime to $endTime $offerStartTime to $offerEndTime Each of the above variables are integers. I want to see if the range offerStartTime to offerEndTime falls in the range startTime and endTime . For example, if the startTime and endTime range was: 10 to 20, then the following example ranges would return true : offerStartTime: 5, offerEndTime: 11 offerStartTime: 5, offerEndTime: 100 offerStartTime: 10, offerEndTime: 15 offerStartTime: 10, offerEndTime: 100