php中float转int的方法
使用round(x,prec)方法
| 参数 | 描述 |
| x | 可选。规定要舍入的数字。 |
| prec | 可选。规定小数点后的位数 |
<?php echo(round(0.60)); echo(round(0.50)); echo(round(0.49)); echo(round(-4.40)); echo(round(-4.60)); 输出: 1 1 0 -4 -5
推荐教程: 《php教程》
Copyright © 2019- 3391111.com 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务