wright67uk Posted March 4, 2013 Share Posted March 4, 2013 How can I test a number for digits after a decimal point? I would like to do somthing like; $num = 5.34 If the digits after the decimal point of $num are less than .10 then round down, else $num++ The idea being that this could be used in a loop until either a whole number is found, or until a number is rounded down. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 4, 2013 Share Posted March 4, 2013 (edited) $decimal = $num - floor($num); Edited March 4, 2013 by Barand Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.