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. Link to comment https://forums.phpfreaks.com/topic/275217-testing-part-numbers/ Share on other sites More sharing options...
Barand Posted March 4, 2013 Share Posted March 4, 2013 $decimal = $num - floor($num); Link to comment https://forums.phpfreaks.com/topic/275217-testing-part-numbers/#findComment-1416439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.