php integer and float comparison mismatch

前端 未结 3 604
后悔当初
后悔当初 2020-11-29 13:49

I have the following code

$amount1 = 7299;
$amount2 = 72.9875;

$amount2_in_cents = round($amount2, 2) * 100;

if ($amount1 != $amount2_in_cents) {
    echo          


        
3条回答
提交回复
热议问题