Returns an integer that is the next larger than the float used as the argument. In essence, it rounds up a floating-point number to an integer, no matter what the value of the floating-point integer is. It doesn’t round down.
ceil(int|float $num): float
The ceil() function takes a floating-point number as its only parameter and rounds it to the nearest integer above its current value. If you provide an integer, nothing will happen. For example:
$number = ceil(11.9); // 12 $number = ceil(11.1); // 12 $number = ceil(11); // 11
|num||The value to round.|
num rounded up to the next highest integer. The return value of ceil() is still of type float as the value range of float is usually bigger than that of int.
Example 1: Round up a floating-point number:
$number = 12.023; echo "The next highest integer of $number is ", ceil($number);
echo ceil(4.3); // 5 echo ceil(9.999); // 10 echo ceil(-3.14); // -3