1. Home
  2. Computing & Technology
  3. PHP / MySQL

Rounding and Formatting Numbers

By Angela Bradley, About.com

3 of 4

Floor () - Always Rounding Down

The Floor() PHP function is used to always round down to the nearest whole number. The PHP function Floor () behaves identical to the MySQL use; even the largest decimal will always be rounded down.
<?php
echo floor(3.14159265);
// Value would be 3

echo ceil(3.99999999);
// Value would be 3

echo ceil(-3.14159265);
// Value would be -4
?>

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Floor PHP Function - PHP Floor number - Floor number function

©2009 About.com, a part of The New York Times Company.

All rights reserved.