Home >Backend Development >PHP Tutorial >深入php处理整数函数的详解_php技巧

深入php处理整数函数的详解_php技巧

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-17 09:02:15989browse

Ceil: 计算大于指定数的最小整数。
Floor: 计算小于指定数的最大整数。
round: 四舍五入。

根据需要选用

复制代码 代码如下:

$a=20;
$b = 6;
echo ($a/$b)."
"; //out 3.3333333333333
echo ceil($a/$b)."
"; //out 4
echo floor($a/$b)."
"; //out 3
echo round($a/$b)."
"; //out 3
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn