PHP最低的共同面额

ovi*_*cko 0 html php opencart

我正在使用支付网关,金额参数需要以这种方式格式化:
amount – (digits only) the integer value of the transaction in lowest common denomination (ex. $5.20 is 520)
我已经删除了$所有值,所有值将四舍五入到小数点后两位.

在PHP中,如果我尝试将数量转换为intie ,即使它需要,(int)$amount我将在示例中松开.20.什么是最好的方法呢?

Nig*_*Ren 6

您可以将金额乘以100,然后将其转换为......

$amount = (int)($amount*100);
Run Code Online (Sandbox Code Playgroud)

所以5.20变成了520.