删除PHP中的所有小数 [英] Removing all decimals in PHP
本文介绍了删除PHP中的所有小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从我的资料库中取得:
252.587254564
我想删除 .587254564
并保留 252
,我该怎么办?
Well i wanna remove the .587254564
and keep the 252
, how can i do that?
我应该使用什么功能,你能告诉我一个例子吗?
What function should i use and can you show me an example?
问候
推荐答案
您可以在PHP中执行:
You can do it in PHP:
round($val, 0);
或您的MYSQL语句中:
or in your MYSQL statement:
select round(foo_value, 0) value from foo
这篇关于删除PHP中的所有小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文