我正在尝试做一个简单的条件,如果我之前的交易总额加上我想从信用卡中扣除的金额小于或等于发票总额,而不是我可以从信用卡中收取的金额>
$amount_to_charge = (float)$_REQUEST['cc_amount'];
Log::error("PAID TYPE : ".gettype(($book->totalPaid() + $amount_to_charge)));
Log::error("Total Type : ".gettype($book->bookedGrandTotal()));
Log::error(($book->totalPaid() + $amount_to_charge)." <= ".$book->bookedGrandTotal());
if(($book->totalPaid() + $amount_to_charge) <= $book->bookedGrandTotal())
{
Log::error("AMT OK");
}
else
{
Log::error("AMT NOT OK");
$error['ERROR'] = "The maximal amount you can charge is : $".($book->bookedGrandTotal()-$book->totalPaid());
}
日志响应:
[2018-08-02 10:01:24] dev.ERROR: PAID TYPE : double
[2018-08-02 10:01:24] dev.ERROR: Total Type : double
[2018-08-02 10:01:24] dev.ERROR: 142.56 <= 142.56
[2018-08-02 10:01:24] dev.ERROR: AMT NOT OK
142.56应该等于142.56,所以我应该输入if语句?