PHP ceil() function with example

 15 - Mar - 2022
 XpertPhp
 36

In this article, We will explain to you PHP ceil() function with example.

PHP ceil() function

The ceil() function is a built-in function of PHP. which is used to returns the value of a number rounded UPWARD to the nearest integer. so you can see our PHP math Function example.

Syntax

ceil(number);

Example

<?PHP
echo ceil(5.8);
echo "
";
echo ceil(-5.1);
echo "
";
echo ceil(-5.9);
echo "
";
echo ceil(5);
echo "
";
echo ceil(0.1);
echo "
";
echo ceil(1.8);
?>

Output

6
-5
-5
5
1
2

Reference: PHP ceil() function