83
PHP ceil() function
The ceil() function is often used to calculate the mathematical problems. It is in-built function to find the round number up to the nearest integer.
Note1 : To round a number down to the nearest integer, then use floor() function.
Note2 : To round a floating-point number, then use round() function.
Syntax:
It returns the next highest value by rounding up value if necessary.
Parameter | Description | Required /Optional |
---|---|---|
Value | Specifies the value to round up. | Required |
Example1
Output:
1
Example2
Output:
5
Example 3
Output:
-4
Example4
Output:
-6
Example 5
Output:
66.41 66.4
Example 6
Output:
The actual value: 77.4 The ceil() used: 77.41 The round() used: 77.4
Next TopicPHP Math