php - 从 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
关于如何实现这一目标的任何建议?
解决方案
你能把rtrim()
他们关掉吗?
echo rtrim(number_format(…), '0');
推荐阅读
- php - 商店设置中的 Opencart 3 多语言字段
- bash - 无法找出 Cygwin 别名的问题
- javascript - 当我订阅我的服务方法(执行查询)时,如何检索从 FireStore DB 检索到的每个文档的 UID?
- regex - 字符串的正则表达式
- python - 如何使用 python 对单词进行良好的标记化
- html - 无法使元素达到导航栏高度
- python - 用 docker 设置烧瓶
- python - 在 freeBSD 上安装 pandas
- api - 如何根据特定类别获取场地?
- ios-simulator - 关于iOS App开发中Imageview和button的链接