vendredi 26 avril 2019

When I try to check if more then 1 parameter is true in IF statement the code won't work anymore...why?

I'm perplex about an IF statement I'm trying to make work. I need to check if the actual hour is in a range of numbers...

Example:

$currentTime=date('H', $dateToCheck);

if($currentTime<18 && $currentTime>7)
{
   do something;
}

The problem is that whenever I try to check the time with only one statement the IF will work but if I use "&&" and add another statement the IF won't work anymore.

(Of course both of the statement are true so the if should be executed)

The code I'm actually working on is the following

    $orarioMess=date('H',$queryDate);
    if($orarioMess<18 && $orarioMess>7)
    {
      $status=12;
      $checkStatus=1;
    }

I expect the IF still to be executed even with 2 statements to check. I have no clue why it isn't working...

Aucun commentaire:

Enregistrer un commentaire