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

Rounding and Formatting Numbers

By , About.com Guide

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
?>

Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

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

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

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

All rights reserved.