PHP ceil() Function

Definition and Usage

The ceil() function is an in-built function in PHP iterpreter. This function accepts any float number as argument and rounds it up to the next highest integer.

This function always returns a float number as range of float is bigger than that of integer.

Syntax

ceil ( float $num ) : float

Parameters

Sr.No Parameter & Description
1 num
The number to be rounded up.

Return Values

PHP ceil() function returns the smallest integer value that is bigger than or equal to given parameter.

PHP Version

This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.

Example

<?php
   $arg=-3.95;
   $val=ceil($arg);
   echo "ceil(" . $arg . ") = " . $val;
?>

Output

This will produce following result −

ceil(-3.95) = -3
Updated on: 2026-03-11T23:22:53+05:30

400 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements