How to use the ceil function in php?
The ceil() function in PHP is used to round a number up to the nearest integer greater than or equal to the given number. To use it, simply call the function with the desired number as an argument.
$number = 3.14;
$ceilNumber = ceil($number);
echo $ceilNumber; // 输出 4
$negativeNumber = -5.8;
$ceilNegativeNumber = ceil($negativeNumber);
echo $ceilNegativeNumber; // 输出 -5
The parameter of the ceil() function is the number to be rounded up, it can be a positive number, a negative number, or a floating-point number, and the result returned is an integer.
Note: If the parameter passed in is already an integer, then the function will directly return that number.