不四舍五入只取整数
floor函数 2.1 = 2
2.6 = 2
不四舍五入浮点进1
ceil函数:2.1 = 3
2.6 = 3
ceil(-3.14)=-3
ceil(9.99)=10
四舍五入
round函数:2.1 = 2
2.6 = 3
round(1.95583, 2)=1.96
转换整形
intval函数 2.1 = 2
2.6 = 2
intval('abc')=0
intval('5bc')=5
以上就是php float函数四舍五入的实例代码的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号