Tuesday, May 23, 2017

Show warning from hour to another hour in PHP/ Laravel

I want to show a warning from an hour to another..

Here is what i've tried

$currentHour = date('H');
if ($currentHour >= 18 || $currentHour < 5) {
            echo 'warning <br>';
        }else{
            echo 'no warning';
        }

But I have the next problem. I want to show this warning from 18 to 5 in the morning..

If my current hour is 16

16 >= 18 => false
16 < 5 => false

How can I resolve this problem...? I want to show this message from 18 to 5 morning



via ypfmclartyo

Advertisement