Lowest nearest integer of a number by floor()

floor() function returns the highest integer lower than the given number or the nearest integer ( on lower side ) of the number.
echo floor(2.7).'<br>'; // Output 2
echo floor(2.4).'<br>'; // Output 2
echo floor(2.5).'<br>'; // Output 2
echo floor(-10.8).'<br>'; // Output -11
echo floor(-10.3).'<br>'; // Output -11
echo floor(-10.5).'<br>'; // Output -11
We get the just lower nearest integer from the number.

Here is a comparison between ceil(), floor() and round() function. For different input numbers we will get different values by using these functions.
Note that there is no point is using ceil() or floor() functions on integers directly. ( we will get the same value )
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-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer