PHP : ceil() function
Description
The ceil() function is used to get the next highest integer value by rounding up.
Version
(PHP 4 and above)
Syntax
ceil (num_value)
Parameter
Name | Description | Required / Optional |
Type |
---|---|---|---|
num_value | The value to round. | Required | Float |
Return value
Rounded up to the next highest integer of num_value.
Value Type : Float.
Pictorial Presentation
Example :
<html>
<body>
<?php
$ceil1=ceil(9.4);
$ceil2=ceil(29.449);
$ceil3=ceil(-8.4);
$ceil4=ceil(801.9);
$ceil5=ceil(1200.94);
echo "Result of ceil(9.4) is : ". $ceil1 . "<br />" ;
echo "Result of ceil(29.449) is : ". $ceil2 . "<br />" ;
echo "Result of ceil(-8.4) is : ". $ceil3 . "<br />" ;
echo "Result of ceil(801.9) is : ". $ceil4 . "<br />" ;
echo "Result of ceil(1200.94) is : ". $ceil5 . "<br />";
?>
</body>
</html>
Output:
Result of ceil(9.4) is : 10 Result of ceil(29.449) is : 30 Result of ceil(-8.4) is : -8 Result of ceil(801.9) is : 802 Result of ceil(1200.94) is : 1201
View the example in the browser
See also
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/php/function-reference/ceil.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics