Round up a decimal number to the nearest integer

Posted by Shek on April 23, 2008 under PHP | Be the First to Comment | Total View: 420 views

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:

<?php 
echo ceil(8.8); 
?>

we get: 9

<?php 
echo ceil(-12.66);
?>

we get: -12

<?php 
echo ceil(900.45563);
?>

we get: 901

Similar Posts:

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

Add A Comment

*