PHP floor() function
Complete PHP Math Reference
Definition and Usage
The floor() function returns the value of a number rounded DOWNWARDS to the
nearest integer.
Syntax
| Parameter |
Description |
| x |
Required. A number |
Example
In this example we will use the floor() function on different numbers:
<?php
echo(floor(0.60) . "<br />");
echo(floor(0.40) . "<br />");
echo(floor(5) . "<br />");
echo(floor(5.1) . "<br />");
echo(floor(-5.1) . "<br />");
echo(floor(-5.9))
?>
|
The output of the code above will be:
Complete PHP Math Reference
|