PHP floor() 函数

PHP 教程 · 2019-01-26 21:57:19

实例

向下舍入为最接近的整数:

<?php
echo(floor(0.60) . "<br>");
echo(floor(0.40) . "<br>");
echo(floor(5) . "<br>");
echo(floor(5.1) . "<br>");
echo(floor(-5.1) . "<br>");
echo(floor(-5.9));
?>

定义和用法

floor() 函数向下舍入为最接近的整数。

提示:如需向上舍入为最接近的整数,请查看 ceil() 函数。

提示:如需对浮点数进行四舍五入,请查看 round() 函数。

语法

floor(number);

参数 描述
number 必需。规定需向下取整的值。

技术细节

返回值: 向下舍入的最接近的整数值。
返回类型: Float
PHP 版本: 4+

点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

The Book of CSS3

The Book of CSS3

Peter Gasston / No Starch Press / 2011-5-13 / USD 34.95

CSS3 is the technology behind most of the eye-catching visuals on the Web today, but the official documentation can be dry and hard to follow. Luckily, The Book of CSS3 distills the heady technical la......一起来看看 《The Book of CSS3》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具