me102 Posted December 19, 2007 Share Posted December 19, 2007 I have a problem with my numbers they come out like this 6.1 but I want them to come out like this 6.10. Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/ Share on other sites More sharing options...
corbin Posted December 19, 2007 Share Posted December 19, 2007 http://php.net/number_format Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-418987 Share on other sites More sharing options...
teng84 Posted December 19, 2007 Share Posted December 19, 2007 <?php $number = 16.10; $txt = sprintf("%1\$.2f",$number); echo $txt; echo '<br>'; echo $number; ?> Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-418990 Share on other sites More sharing options...
me102 Posted December 19, 2007 Author Share Posted December 19, 2007 http://php.net/number_format How would I get it to put a / ever 1000? $total = number_format($total, 2, '.', ''); Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-418992 Share on other sites More sharing options...
corbin Posted December 19, 2007 Share Posted December 19, 2007 echo number_format(2.2, 2); //2.20 "How would I get it to put a / ever 1000?" Uhhh, I don't understand what you're asking. Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-419002 Share on other sites More sharing options...
me102 Posted December 19, 2007 Author Share Posted December 19, 2007 echo number_format(2.2, 2); //2.20 "How would I get it to put a / ever 1000?" Uhhh, I don't understand what you're asking. This is how the number comes out 6000.50 this is what it should look like 6,000.50 Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-419006 Share on other sites More sharing options...
corbin Posted December 19, 2007 Share Posted December 19, 2007 echo number_format(2000.2, 2); //2,000.20 It defaults to seperating thousands with ,. Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-419008 Share on other sites More sharing options...
teng84 Posted December 19, 2007 Share Posted December 19, 2007 number_format($number, 2, '.', ','); Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-419010 Share on other sites More sharing options...
me102 Posted December 19, 2007 Author Share Posted December 19, 2007 number_format($number, 2, '.', ','); Thank you. Link to comment https://forums.phpfreaks.com/topic/82412-solved-61-to-600/#findComment-419026 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.