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. Quote Link to comment Share on other sites More sharing options...
corbin Posted December 19, 2007 Share Posted December 19, 2007 http://php.net/number_format Quote Link to comment 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; ?> Quote Link to comment 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, '.', ''); Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 ,. Quote Link to comment Share on other sites More sharing options...
teng84 Posted December 19, 2007 Share Posted December 19, 2007 number_format($number, 2, '.', ','); Quote Link to comment Share on other sites More sharing options...
me102 Posted December 19, 2007 Author Share Posted December 19, 2007 number_format($number, 2, '.', ','); Thank you. 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.