I have 2 range of numbers:
$startTime
to $endTime
$offerStartTime
to $offerEndTime
After some time I have found an efficient simple solution that seems to work (feel free to tell me if it doesn't).
($offerStartTime <= $startTime && $offerEndTime > $startTime) ||
($offerStartTime > $startTime && $offerStartTime < $endTime)
I will also be looking at answers that are better than mine, so please still send me your solution.