Hi I want to show an alert from hour X to hour Y
$currday = date('l'); $starting_hour = DB::table('time')->select('starting_hour')->where('day' == $currday)->get(); $ending_hour = DB::table('time')->select('ending_hour')->where('day' == $currday)->get(); $currhour = date('H')
if($currhour > $starting_hour || $currhour < $ending_hour) return 'yes alert'; else return 'no alert';
$currhour is equal to 11. Here is a problem beacause I want to show this alert only if the currhour is on the interval 18 - 22. Another case is when the interval 18 - 9 (the next day).. here will work well because 11 it's < than 18 and 11 it's > than 9..
How can I solve all of the case?
EDIT: CASES USING
$starting_h = 16; $ending_h = 22; $currenthour = 5;
if i'm using
if($currhour >= 16 || $currhour <= 22)
will return true.. but I want to return this alert only at: 161718