Php ceil is a built-in function in PHP, which is used to round up to the nearest integer. Its usage syntax is "ceil(number);", and the parameter number specifies the value that needs to be rounded up.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
What does ceil mean in Php?
ceil() function rounds up to the nearest integer.
Tip: To round down to the nearest integer, check out the floor() function.
Tip: If you need to round floating point numbers, check out the round() function.
Syntax
ceil(number);
Parameters
number Required. Specifies the value to be rounded up.
Example
Round up to the nearest integer:
<?php echo(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)); ?>
Output:
1 1 5 6 -5 -5
Recommended learning: "PHP Video Tutorial》
The above is the detailed content of What does ceil mean in Php. For more information, please follow other related articles on the PHP Chinese website!