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. Link to comment https://forums.phpfreaks.com/topic/117693-echoing-decimal-place-only/ Share on other sites More sharing options...
ratcateme Posted August 1, 2008 Share Posted August 1, 2008 substr($number,strpos($number,'.')+1); Scott. Link to comment https://forums.phpfreaks.com/topic/117693-echoing-decimal-place-only/#findComment-605361 Share on other sites More sharing options...
GingerRobot Posted August 1, 2008 Share Posted August 1, 2008 $num = 3.67; $decimal = $num - floor($num); Link to comment https://forums.phpfreaks.com/topic/117693-echoing-decimal-place-only/#findComment-605377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.