Comma seperated money values?
Posted: Thu Jan 14, 2010 3:12 pm
Hi all, how can I make it so that no matter HOW many numbers are in this string, it seperates them correctly w/ a comma, so it displays the correct amount of money?
code:
Also, how can I make it so that if it's an even amount, such as: $100, or $101, it adds a ".00" to the end? or if its a number under 9 cents, it adds a ".0", or if it's 90 cents, it adds a "0" to the end of it, so: "$1,000,000,000,000,000.01", "$109,000,000,000,000,000.09", "$109,000,000,000,000,000.90"
So: $100.00
Thanks!
ShadowIce~
code:
Code: Select all
<?php
$Total = "012345678901234567890000";
echo "Your total: <b><u>$".$Total."</u></b><br>\n";
?>So: $100.00
Thanks!
ShadowIce~