English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

ceil() function in PHP

Theceil()The function rounds a number to the nearest integer. The value is rounded up to the nearest largest integer.

Syntax

ceil(num)

parameter

  • num-the number to be rounded

returns

Theceil()The function returns the value rounded up to the nearest integer.

Example

<?php
   echo(ceil(0.90)  .  "<br>");
   echo(ceil(0.15)  .  "<br>");
?>

Output Result

1<br>1<br>

Example

Let's look at another example-

<?php
   echo(ceil(2));
?>

Output Result

2

Example

Let's look at another example-

<?php
   echo(ceil(8.9)  .  "<br>");
   echo(ceil(-9.2)  .  "<br>")
?>

Output Result

9<br>-9<br>