I am having difficulty after doing some simple decimal math in PHP with values, not cross-footing and comparing as expected. So, I put together a simple test to show myself what is wrong but I continue to get unexpected results.
This example should test to FALSE but it doesn't, Why is that.
What is going on with the decimal values that don't compare as expected?
If I change the "!="
to a "<"
it compares TRUE
. Why is that?
I have tried various combinations of not ==
, !=
, etc. but nothing seems to work as expected.
What is going on here?
$diff = 17466.47 - 8530.65;
If ($diff != 8935.82) {
Process as an error...
}