CEIL code example
Example 1: ceil and floor
Examples of Floor:
=====================
Input : 2.5
Output : 2
Input : -2.1
Output : -3
Input : 2.9
Output : 2
===============================
Examples of Ceil:
=====================
Input : 2.5
Output : 3
Input : -2.1
Output : -2
Input : 2.9
Output : 3
Example 2: round up built in function php
echo ceil(0.5);
Example 3: js ceil
Math.ceil(1.2);
Example 4: php round up
<?php
echo 'Rounding modes with 9.5' . PHP_EOL;
var_dump(round(9.5, 0, PHP_ROUND_HALF_UP));
var_dump(round(9.5, 0, PHP_ROUND_HALF_DOWN));
var_dump(round(9.5, 0, PHP_ROUND_HALF_EVEN));
var_dump(round(9.5, 0, PHP_ROUND_HALF_ODD));
echo 'Rounding modes with 8.5' . PHP_EOL;
var_dump(round(8.5, 0, PHP_ROUND_HALF_UP));
var_dump(round(8.5, 0, PHP_ROUND_HALF_DOWN));
var_dump(round(8.5, 0, PHP_ROUND_HALF_EVEN));
var_dump(round(8.5, 0, PHP_ROUND_HALF_ODD));
?>
Example 5: javascript math ceiling function
Math.ceil()
Example 6: ceil
ceil ( float $value ) : float
Returns the next highest integer value by rounding up value if necessary.