floor() function in PHP

PHPProgrammingServer Side Programming

The ceil() function rounds a number down to the nearest integer.

Syntax

floor(num)

Parameters

  • num − The number to round up

Return

The floor() function Returns the value rounded up to the nearest (down) integer.

Example

 Live Demo

<?php
   echo(floor(0.10) . "<\n>");
   echo(floor(0.55) );
?>

Output

0
0

Let us see another example −

Example

 Live Demo

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

Output

9

Let us see another example −

Example

 Live Demo

<?php
   echo(floor(7.8) . "\n");
   echo(floor(-4.2));
?>

Output

7
-5
raja
Published on 09-Nov-2018 06:51:51
Advertisements