Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP ceil() Function

PHP ceil() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Round up to the nearest integer:

"); echo(ceil(0.40) . "
"); echo(ceil(5) . "
"); echo(ceil(5.1) . "
"); echo(ceil(-5.1) . "
"); echo(ceil(-5.9)); ?>

Run Example »


Definition and Usage

The ceil() function rounds up to the nearest integer.

**Tip:** To round down to the nearest integer, see floor() function in Vue 3.

**Tip:** To round a float to the nearest integer, see round() function in Vue 3.


Syntax

ceil(

number

);

Parameters Description
number Required. Specifies the value to round up.

Technical Details

Return Value: The nearest integer value rounded up.
Return Type: Float
PHP Version: 4+

PHP Math Reference Manual PHP Math Reference Manual