The floor Function

The floor function rounds a fraction down. This means that regardless of the digit at the beginning of the fractional part, the fraction will still be rounded without increasing the integer part by 1. For example, 12.9 will be rounded to 12.

Syntax

phpfloor(number);

Example

Let's round 4.9 down:

php<?php
  echo floor(4.9);
?>

Code execution result:

php4

See Also

  • the round function,
    which rounds a fraction according to mathematical rules
  • the ceil function,
    which rounds a fraction up