Round down a decimal number to the nearest integer

Posted by Shek on April 24, 2008 under PHP | 2 Comments to Read

In my past post, I talked about rounding up a decimal number to the nearest integer. This time I will show you how to round “down” a decimal number to the nearest integer. This time we use a function floor( ). It is very easy to use, all you have to do is to put the decimal number inside the brackets and it will convert for you. Here are some examples:

Read more of this article »

Round up a decimal number to the nearest integer

Posted by Shek on April 23, 2008 under PHP | Be the First to Comment

If you want to round up a decimal number to the nearest integer. There is a function ceil( ) could do the job. It is very easy to use, all you have to do is to put the decimal number inside the brackets and it will convert the number. Here are some examples:

Read more of this article »