Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP floor() function is used to return the next lowest integer value by rounding down the specified number, if necessary. In other words, it rounds the fraction DOWN of the given number.

Syntax

floor(number)

Parameters

number Required. Specify a number.

Return Value

Returns the next lowest integer value by rounding DOWN the specified number, if necessary.

Example:

In the below example, floor() function is used to round the fraction DOWN of the specified number.

<?php
  echo floor(10.5)."\n";
  echo floor(-10.5)."\n";
  echo floor(0.5)."\n";
  echo floor(-0.5)."\n";
?>

The output of the above code will be:

10
-11
0
-1

❮ PHP Math Functions