English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

floor() function in PHP

Thisceil()The function rounds the number to the nearest integer.

Syntax

floor(num)

parameter

  • num-the number to be rounded

returns

Thisfloor()The function returns the value rounded down to the nearest integer.

Example

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

Output Result

0
0

Let's look at another example-

Example

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

Output Result

9

Let's look at another example-

Example

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

Output Result

7
-5