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 overriding in php?

620


How to swap two variables without using 3rd temp variable.

501


How error handling is being handled by php?

556


How to remove values saved in the current session?

541


Explain me differences between get and post methods?

574






What are php errors?

502


Is php fully object oriented?

497


Explain a resource?

626


How do you count numbers in php?

518


What does $_cookie mean?

542


How can we execute a php script using command line?

530


What exactly is validating and sanitizing?

627


Which is the best php framework for a beginner?

534


What is api example?

538


How to define a user function?

582