Home  >  Article  >  Backend Development  >  What does ceil mean in Php

What does ceil mean in Php

藏色散人
藏色散人Original
2021-05-19 09:12:413601browse

Php ceil is a built-in function in PHP, which is used to round up to the nearest integer. Its usage syntax is "ceil(number);", and the parameter number specifies the value that needs to be rounded up.

What does ceil mean in Php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

What does ceil mean in Php?

ceil() function rounds up to the nearest integer.

Tip: To round down to the nearest integer, check out the floor() function.

Tip: If you need to round floating point numbers, check out the round() function.

Syntax

ceil(number);

Parameters

number Required. Specifies the value to be rounded up.

Example

Round up to the nearest integer:

<?php
echo(ceil(0.60) . "<br>");
echo(ceil(0.40) . "<br>");
echo(ceil(5) . "<br>");
echo(ceil(5.1) . "<br>");
echo(ceil(-5.1) . "<br>");
echo(ceil(-5.9));
?>

Output:

1
1
5
6
-5
-5

Recommended learning: "PHP Video Tutorial

The above is the detailed content of What does ceil mean in Php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn