在十进制数字中如何除去小数点后的多余零以及如何避免舍入数字。 我曾尝试下面的代码如何在十进制值中插入逗号并删除多余的零
$example = "123456";
$exmaple2= "55.369";
$subtotal = number_format($example, 2, '.', ',');
$subtotal1 = number_format($exmaple2, 2, '.', ',');
echo $subtotal."<br/>";
echo $subtotal1;
得到输出
123,456.00
55.37
预期输出
123,456
55.369
正在打印的小计值123,其中,因为我需要123,456其他明智的代码是每个fect – atk
检查我编辑的答案。 – shubham715
它是非常工作非常感谢你 – atk