dimanche 30 août 2020

Compare a number to see if it is between the past values

I'm going through a difficulty that I believe is not something so difficult, but for me it is being kkk. I want to compare a number to see if it is between two past values.

My logic is from this example below, but it is not working.

Examples:

$x = 197
$pastValue1 = 300
$pastValue2 = 600

$x = 420
$pastValue1 = 300
$pastValue2 = 600

if ($x >= $pastValue1 && $x <= $pastValue2) {?>
<div class = "detailsProd">
<p> Number <? php echo $x;?> is among the past values </p>
</div>
<? php} else { ?>
<p> Number <? php echo $x;?> is not among the past values </p>
<? php}?>

Aucun commentaire:

Enregistrer un commentaire