PHPSuperBlog.com

Round up a decimal number to the nearest integer

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

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Similar Posts:

Leave a comment