Php中ceil什么意思
2022-12-02 09:01:16
103
{{single.collect_count}}

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中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}