Getting the higher and lower hundred value using ceil and floor function in PHP

IN 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

$v = ceil(6.25);
// which would make $v=7
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.

//$v_max equal to 500
Same way we can find out the lowest value of a figure using floor function in php
//$v_min equal to 400
Note that there is no point is using ceil and floor functions on integers directly. ( we will get the same value )
Visitors Rating
Your Rating


Post Comment This is for short comments only. Use the forum for more discussions.

HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2017 All rights reserved worldwide Privacy Policy Disclaimer