Getting the higher and lower hundred value using ceil and floor function in PHPIN an umber we can find out the next higher integer using ceil function. This function is different than round function. In case of round function the value is rounded to higher or lower value, but here it is always higher value is returned. Here is an example
This function is useful when we search for a next higher hundred or thousand value of a number. For example we have a number 785 and wants to know what is the next higher hundredth number ( that is 800 ). To know this we can use ceil function. If you are generating a graph and coordinates are fixed according to high and low value of the data then using this function we can find out what should be our highest point in the graph.
Same way we can find out the lowest value of a figure using floor function in php
Note that there is no point is using ceil and floor functions on integers directly. ( we will get the same value )
Be the first to post comment on this article :