PHP floor() 函数

jackxiang 2009-12-23 21:59 | |
Definition and Usage
定义和用法
The floor() function returns the value of a number rounded DOWNWARDS to the nearest integer.
floor()函数的作用是:通过舍去法取整(即:返回的值必须是小于等于给定数值的最大整数)。

Syntax
语法
floor(x)
Parameter参数 Description描述
x Required. A number
必要参数。指定一个数值对象

Example
案例
In this example we will use the floor() function on different numbers:
下面的案例使用floor ()函数返回了不同数值参数对应的不同结果,注意观察、比较:

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

The output of the code above will be:
上述代码将输出下面的结果:

0055-6-6


用来做分页可能有点用。
原文地址:http://www.isstudy.com/phpjc/963.html

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/2373/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2009-12-23 22:01
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]