lundi 5 octobre 2015

How to compare integer with decimal?

I have a function which returns a value like 61.740900630055.

Now I want to check if this value is less than 25.

My code:

$returnVal = 13.740900630055;

if($returnVal <= 25)
    echo "Less than 25 Miles";
else
    echo "More than 25 Miles";

But it is showing as "More than 25 Miles".

I am not too sure if this is the case of type mismatching.

Aucun commentaire:

Enregistrer un commentaire