$amount = (256.34 * 100);
echo (int) ($dollor_amount);
// out should be 25634 but this giving 25633, not sure why?
$amount = (255.34 * 100);
echo (int) ($dollor_amount);
// For 255.34 it returning fine output 25534
有什么限制问题吗? 它仅在 256 号之后表现意外。
使用浮点数而不是整数。 您将获得所需的结果作为您的问题。
$amount = (256.34 * 100);
echo (float) ($amount);
// out should be 25634 but this giving 25633, not sure why?
$amount = (255.34 * 100);
echo (float) ($amount);