Wednesday, December 17, 2008

How to find floor or ceiling value of a number using php

Following code will show you how to find floor and ceiling values of a floating number. To find floor you can use the php function floor() and ceil() to find ceiling value.


<?php

//examples of floor()
echo floor(7.2); // 7
echo '<br>';
echo floor(7.9); // 7

echo '<br><br>';

echo ceil(7.2); // 8
echo '<br>';
echo ceil(7.9); // 8

?>


Get custom programming done at GetAFreelancer.com!

No comments:

Post a Comment