what will do ceil() and floor() in PHP?

Answer Posted / nilsoft

ceil()
Returns the next highest integer value by rounding up value
if necessary.

<?php
echo ceil(4.3); // 5
echo ceil(9.999); // 10
echo ceil(-3.14); // -3
?>



floor()

Returns the next lowest integer value by rounding down value
if necessary.
<?php
echo floor(4.3); // 4
echo floor(9.999); // 9
echo floor(-3.14); // -4
?>

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between laravel and php?

716


How you can update memcached when you make changes to php?

871


Is python similar to php?

809


What is string function sql?

748


How is it possible to cast types in php?

727


Is multilevel inheritance possible in php?

762


Which php function will attach one file to another?

780


Can we use include ("xyz.php") two times in a php page "index.php"?

811


Explain me what is the use of 'print' in php?

750


What is overloading and overriding in php?

842


Is php better than java?

772


What is php and its uses?

752


Which function is used to read a single character from a file in PHP.

843


How to access a global variable inside a function?

769


How we can retrieve the data in the result set of mysql using php?

781