Jump to content

number formatting echo's in tables.


seany123

Recommended Posts

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

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";


?>

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";


?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.