PHP floor() Math Functions

What is floor Function?

Explanation

The "floor()" function returns the value of a number rounded down to the nearest integer, even a negative number is rounded to the next higher negative value.

Syntax:


floor(x)

In the above syntax "x" is the number to be rounded down to the nearest integer.

Example :


<?php
echo floor(10.1) . "n";
echo floor(-6.2);
?>
Result :

10
-7

In the above example the numbers "10.1", "-6.2" are rounded to the nearest integer "10", "6".

PHP Topics


Ask Questions

Ask Question