HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

floor

Description

The floor of Math for PHP rounds fractions down.

Syntax

floor(
    int|float $num
): float

Parameters

num

The numeric value to round

Return

Returns num rounded to the next lowest integer. The return value of floor() is still of type float.

Examples

1 · num · negative · high

<?

$num = -1.9999;

$return = floor($num);

echo $return;
-2

2 · num · negative · low

<?

$num = -1.0001;

$return = floor($num);

echo $return;
-2

3 · num · non-negative · low

<?

$num = 1.0001;

$return = floor($num);

echo $return;
1

4 · num · non-negative · high

<?

$num = 1.9999;

$return = floor($num);

echo $return;
1