Ceil Function in PHP With Example

Ceil Function in PHP With Example. A Php program to print the number using ceil. In this program, you can print the ceil or rounded number in php program. The ceil() function is a php built-in function for rounding numbers to the closest greater integer. Parameters: The ceil() method takes only one parameter, which indicates the number you want to round up to the next bigger integer.

<?php 
echo (ceil(2.3)."<br/>");
echo (ceil(-5.8)."<br/>");
?>

 

Output:

3

-5

Ceil Function in PHP

The ceil() function is a PHP built-in function for rounding numbers to the closest greater integer. Parameters: The ceil() method takes only one parameter, which indicates the number you want to round up to the next bigger integer. The ceil() function calculates the lowest integer larger or equal to x.

Only one parameter is required for both ceil() and floor(): the number to round. Ceil() rounds the number to the next integer above or below its present value, whereas floor() rounds it to the nearest integer below it.

Break Statement in PHP

The constituent of a line break. In text, the <br> HTML element creates a line break . It’s beneficial when composing a poem or an address where the line division is important. In an HTML document, the <br/> tag signifies a line break. Similarly, the <br/> element comes in handy for crafting poems and addresses. This <br/> tag is used to insert a line break or carriage return within a parent element, such as a paragraph, without causing the parent element to break out.