首页 > 解决方案 > 从 PHP 中的数字中删除十进制 0

问题描述

需要在小数点后删除零,例如100,01201500将变为100,012015

我现在有这个功能:

php echo number_format($plan['price'], 0, '.', '' ) - this remove all decimals

$plan['price'] = 100,12345

echo number_format($plan['price'], 0, '.', '' ) = 100

但我需要做echo ($plan['price']) = 100,12345

关于如何实现这一目标的任何建议?

标签: phpe-commerce

解决方案


你能把rtrim()他们关掉吗?

echo rtrim(number_format(…), '0');

推荐阅读