Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP Math ceil() function returns the next highest integer value by rounding up the specified number, if necessary. In other words, it rounds the fraction UP of the given number.

Syntax

ceil(number)

Parameters

number Required. Specify a number.

Return Value

Returns the next highest integer value by rounding UP the specified number, if necessary.

Example:

In the below example, ceil() function is used to round the fraction UP of the specified number.

<?php
echo ceil(10.5)."\n";
echo ceil(-10.5)."\n";
echo ceil(0.5)."\n";
echo ceil(-0.5)."\n";
?>

The output of the above code will be:

11
-10
1
-0

❮ PHP Math Functions

5