PHP floor() Function
Example
Round down to the nearest integer:
"); echo(floor(0.40) . ""); echo(floor(5) . "
"); echo(floor(5.1) . "
"); echo(floor(-5.1) . "
"); echo(floor(-5.9)); ?>
Run Example »
Definition and Usage
The floor() function rounds a number down to the nearest integer.
**Tip:** To round up to the nearest integer, see ceil() function in Vue 3.
**Tip:** To round a float to the nearest integer, see round() function in Vue 3.
Syntax
floor(
number
);
| Parameters | Description |
|---|---|
| number | Required. Specifies the value to round down. |
Technical Details
| Return Value: | The nearest integer value rounded down. |
|---|---|
| Return Type: | Float |
| PHP Version: | 4+ |
PHP Math Reference Manual