Php中ceil是PHP中的一个内置函数,用于向上舍入为最接近的整数,其使用语法是“ceil(number);”,参数number规定需向上取整的值。
php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用
本文操作环境:windows7系统、PHP7.1版,DELL G3电脑
Php中ceil什么意思?
ceil() 函数向上舍入为最接近的整数。
提示:如需向下舍入为最接近的整数,请查看 floor() 函数。
提示:如需对浮点数进行四舍五入,请查看 round() 函数。
语法
ceil(number);
登录后复制
参数
number必需。规定需向上取整的值。
实例
向上舍入为最接近的整数:
<?phpecho(ceil(0.60) . "<br>");echo(ceil(0.40) . "<br>");echo(ceil(5) . "<br>");echo(ceil(5.1) . "<br>");echo(ceil(-5.1) . "<br>");echo(ceil(-5.9));?>
登录后复制
输出:
1156-5-5
登录后复制
推荐学习:《PHP视频教程》
以上就是Php中ceil什么意思的详细内容,更多请关注php中文网其它相关文章!