What does ceil mean in Php

藏色散人
Release: 2023-03-09 18:54:01
Original
3636 people have browsed it

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);
Copy after login

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));
?>
Copy after login

Output:

1
1
5
6
-5
-5
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!