What is floor() in PHP?
The floor() function in PHP returns the next largest integer less than or equal to a number.
Figure 1 below shows the mathematical representation of the floor() function.
Syntax
float floor(number)
Parameter
This function requires a number to round down as a parameter.
Return value
The floor() function returns the next largest integer less than or equal to the number set as a parameter.
Code
<?php#Positive numberecho("floor(10): ");echo (floor(10));echo("\n");echo("floor(5.3): ");echo (floor(5.3));?><?php#Negative numberecho("floor(-10): ");echo (floor(-10));echo("\n");echo("floor(-5.3): ");echo (floor(-5.3));?>