1. Home
  2. Computing & Technology
  3. PHP / MySQL
photo of Angela Bradley
Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

Rounding Numbers

Thursday June 15, 2006
PHP allows for more than one way to round a number. If you are just doing a traditional round, where anything at or over .5 is rounded up and anything below .5 is rounded down, you would use the round () function.

Sometimes when you're working in whole numbers, you need to round everything up.... for example if you wanted 10 photos per page, and had 52 photos, you could not make 5.2 pages, you would need 6 pages. You can round everything up using the ceil () function. Likewise, you can also round everything down using the floor () function.
Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

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

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

All rights reserved.