Home >>PHP Math Functions >PHP ceil() Function

PHP ceil() Function

PHP ceil() Function

PHP ceil() function is used to round a given input number up to the nearest greater integer. It accepts only a single parameter $number which is the number you want to round to the nearest greater integer. It returns the number which represents the $number rounded to the next highest integer.

Syntax:

  ceil($number);

Parameter Values

Parameter Description
number This is a required parameter. This parameter defines the value to round up.

Here is an example of ciel() function in PHP:

<html>
<body>

<?php

echo ceil(0.50)."<br>";
echo ceil(1.20)."<br>";
echo ceil(1.82)."<br>";

?>

</body>
</html>
Output:
1
2
2

Here is an another example of ciel() function in PHP:

<html>
<body>

<?php

echo ceil(8)."<br>";
echo ceil(1.20)."<br>";
echo ceil(-9.45)."<br>";
echo ceil(-22.99)."<br>";

?>

</body>
</html>
Output:
8
2
-9
-22

No Sidebar ads