PHP - ceil
Trieda
Metóda - ceil
(PHP 4, PHP 5, PHP 7)
This function rounds up a given decimal number to the next higher integer.
Note: Rounds up numbers always away from zero (positive numbers are always rounded up, negative numbers are rounded to a next lower integer).
Procedurálne
- function ceil (float $value) : float
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $value | float | The number to round up. |
Mávratovej hodnoty
Vracia: float
The up-rounded number returned as a float number.
Príklady
<?php
echo ceil(5).'<br>';
echo ceil(5.1).'<br>';
echo ceil(5.4).'<br>';
echo ceil(5.5).'<br>';
echo ceil(5.8).'<br>';
echo ceil (5483.47621).'<br>';
echo ceil("4,8"). "<br />";
echo ceil("4.8"). "<br />";
echo ceil(4,8). "<br />";
?>
This example outputs:
5 6 6 6 6 5484 4 5 Warning: ceil() expects exactly 1 parameter, 2 given in *** on line 10
