47 of 410 menu

The ceil Function

The ceil function rounds a fraction up to the nearest integer. This means that regardless of the digit at the beginning of the fractional part, the fraction will still be rounded up by increasing the integer part by 1. For example, 12.1 will be rounded to 13.

Syntax

ceil(number);

Example

Let's round 5.1 up:

<?php echo ceil(5.1); ?>

Code execution result:

6

See Also

  • the round function,
    which rounds a fraction according to mathematical rules
  • the floor function,
    which rounds a fraction down
byenru