seany123 Posted November 23, 2008 Share Posted November 23, 2008 so basically ive been using: = $english_format_number = number_format(); to format my number values so its more neater and looks better etc. now im faced with a problem... i wish to format this... echo "<td>$" . $member['money'] . "</td>\n"; $member['money'] is a number and i want it to be in the above format... how can this be done. Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/ Share on other sites More sharing options...
genericnumber1 Posted November 23, 2008 Share Posted November 23, 2008 I'm not quite sure what you mean, can't you just do echo "<td>$" . number_format($member['money']) . "</td>\n"; ? Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/#findComment-696653 Share on other sites More sharing options...
seany123 Posted November 23, 2008 Author Share Posted November 23, 2008 no because using that... it will show as 1000 or 10000 or 100000 but using $english_format_number = number_format(); the number will show as 1,000 or 10,000 or 100,000 Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/#findComment-696667 Share on other sites More sharing options...
genericnumber1 Posted November 23, 2008 Share Posted November 23, 2008 Did you even try the code? Because I'm sure it will indeed show as you wish. Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/#findComment-696668 Share on other sites More sharing options...
Garethp Posted November 23, 2008 Share Posted November 23, 2008 number_format($number, 0, '.', ','); Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/#findComment-696671 Share on other sites More sharing options...
redarrow Posted November 23, 2008 Share Posted November 23, 2008 Is this correct...... <?php $member['money']="10000"; echo "<td>$" . number_format($member['money']) . "</td>\n"; ?> result <td>$10,000</td> same result using the number_format ellements <?php $member['money']="10000"; echo "<td>$" . number_format($member['money'] , '0','.',',') . "</td>\n"; ?> Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/#findComment-696672 Share on other sites More sharing options...
seany123 Posted November 24, 2008 Author Share Posted November 24, 2008 Is this correct...... <?php $member['money']="10000"; echo "<td>$" . number_format($member['money']) . "</td>\n"; ?> Well the top code you produced is giving $member['money']= a value in the code... i need to it call that value from my database, which is what its doing.... but then also show it in that format.... ill keep testing. result <td>$10,000</td> same result using the number_format ellements <?php $member['money']="10000"; echo "<td>$" . number_format($member['money'] , '0','.',',') . "</td>\n"; ?> Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/#findComment-697506 Share on other sites More sharing options...
seany123 Posted November 24, 2008 Author Share Posted November 24, 2008 your right.... just tried: echo "<td>$" . number_format($member['money']) . "</td>\n"; and it works. thanks for all help. Link to comment https://forums.phpfreaks.com/topic/133846-number-formatting-echos-in-tables/#findComment-697512 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.