PHP ceil()
Published May 26, 2023
The ceil() function returns the next highest integer value of the fractional argument.
Syntax
$result = ceil(n);
Where n is the fractional number to find the next highest integer value of.
Example
This example demonstrates the usage of the ceil() function with three different arguments, and outputs results of each on a new line:
<?phpecho ceil(9.4)."</br>";echo ceil(6.01)."</br>";echo ceil(-1.637);?>
It results in the following output:
107-1
Codebyte Example
Using ceil() to return the next highest integer value of 2.718:
Learn PHP on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours