Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从浮点值中删除多余的点。
例子:
$amount= 61786.6605..我的php 页面中有一个。我怎样才能获得类似$amount=61786.6605. 请帮我解决这个问题
$amount= 61786.6605..
$amount=61786.6605
floatval() 可能会帮助你:)
echo floatval($amount);
$amount = '61786.6605..'; echo $amount . "<br />"; $print = floatval($amount); echo $print;
因此,两个变量的打印结果 - 带有额外点和浮动的变量是:
61786.6605.. 61786.6605
61786.6605..
61786.6605