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

Rounding and Formatting Numbers

By Angela Bradley, About.com

2 of 4

Ceil () - Always Rounding Up

The Ceil () PHP function is used to always round up to the nearest whole number. The PHP function Ceil () behaves identical to the MySQL use; even the smallest decimal will always be rounded up.
<?php
echo ceil(3.14159265);
// Value would be 4

echo ceil(3.00000001);
// Value would be 4

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

2 of 4

Explore PHP / MySQL

More from About.com

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

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

All rights reserved.