dimanche 1 avril 2018

PHP - Get the Opposite of Logical Operator If test

I have a simple test to determine if there is no overlap between 2 date ranges as follows:

          if(strtotime($endDateA) <= strtotime(trim($startDateB)) or strtotime($startDateA) >= strtotime(trim($endDateB))) {
          }

If one of these is true then the 2 date ranges do not overlap. I now need to flip this to get the opposite but I'm not sure how to go about this using the ! or the || operators.

I don't have much experience with these in PHP and haven't been able to get anything working so far. In other languages I would normally do something like this:

(EndA <= StartB or StartA >= EndB) // original test
NOT (EndA <= StartB or StartA >= EndB) // opposite test

but I can't work out how to do the same in PHP.

Aucun commentaire:

Enregistrer un commentaire