PHP floor() Function

PHP Math Reference : Round numbers down to the nearest integer

Definition and Usage

The floor() function rounds a number DOWN to the nearest integer, if necessary, and returns the result.

Tip: To round a number UP to the nearest integer, look at the ceil() function.
Tip: To round a floating-point number, look at the round() function.

Syntax

floor(number);

Parameter Values

Parameter Description
number Required. Specifies the number to round down

Technical Details

Return Value: The value rounded down to the nearest integer
Return Type: Float
PHP Version: 4+

❮ PHP Math Reference