ShoeLace1291 Posted August 1, 2008 Share Posted August 1, 2008 Ok, I'm trying to make a 5 star rating system so I need to find out what the decimal place is and whether or not to round to .5 or to .0. How do I display just the decimal place? Example: 3.7 how do i just find the 7? I thought about using substr, but that would only work if the decimal places would be the same length. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 1, 2008 Share Posted August 1, 2008 substr($number,strpos($number,'.')+1); Scott. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 1, 2008 Share Posted August 1, 2008 $num = 3.67; $decimal = $num - floor($num); 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.