<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Formatting money / currency using PHP</title>
	<atom:link href="http://www.christopherjason.com/articles/format-money-currency-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.christopherjason.com/articles/format-money-currency-php/</link>
	<description>web development, web design, technical communication information for novices and experts</description>
	<pubDate>Fri, 16 May 2008 12:40:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: parwanto</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-64329</link>
		<dc:creator>parwanto</dc:creator>
		<pubDate>Fri, 16 Nov 2007 07:45:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-64329</guid>
		<description>how about this :

if I want to view with format "###,###,###.###"
and i have value 100,000,000.010
and will display 100,000,000.01

</description>
		<content:encoded><![CDATA[<p>how about this :</p>
<p>if I want to view with format &#8220;###,###,###.###&#8221;<br />
and i have value 100,000,000.010<br />
and will display 100,000,000.01</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Jason</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-3012</link>
		<dc:creator>Christopher Jason</dc:creator>
		<pubDate>Thu, 14 Dec 2006 00:24:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-3012</guid>
		<description>Hi Rob-

This should work:
&lt;code&gt;
&#60;?php
// Will print $2.50
$number = 2.5;
$formatted = number_format($number,2);
?&#62;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi Rob-</p>
<p>This should work:<br />
<code><br />
&lt;?php<br />
// Will print $2.50<br />
$number = 2.5;<br />
$formatted = number_format($number,2);<br />
?&gt;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Bursmith</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-2993</link>
		<dc:creator>Rob Bursmith</dc:creator>
		<pubDate>Wed, 13 Dec 2006 16:36:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-2993</guid>
		<description>Works great minus one problem, if I have a dollar amount such as $2.50 it does not echo the 0, thus showing up as $2.5  

What would I do to force the currency to show the amount as $2.50?</description>
		<content:encoded><![CDATA[<p>Works great minus one problem, if I have a dollar amount such as $2.50 it does not echo the 0, thus showing up as $2.5  </p>
<p>What would I do to force the currency to show the amount as $2.50?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Jason</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-2072</link>
		<dc:creator>Christopher Jason</dc:creator>
		<pubDate>Mon, 20 Nov 2006 03:15:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-2072</guid>
		<description>Plankton-

Try the code below. I commented areas to indicate what each code block is doing.

&lt;code&gt;
&#60;?php
/*
This assumes that the column(field) you are selecting is called column, and the table is called your_table.
*/
$total = 0; // Declare total variable
$sql=&#34;SELECT column FROM your_table&#34;; // SQL statement to run
$result=mysql_query($sql); // Query database

// Loops through query result and adds each value to $total
while ($row = mysql_fetch_array($result)) {
	$total = $total + $row[column];
}
echo $total; // Prints total to screen
?&#62;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Plankton-</p>
<p>Try the code below. I commented areas to indicate what each code block is doing.</p>
<p><code><br />
&lt;?php<br />
/*<br />
This assumes that the column(field) you are selecting is called column, and the table is called your_table.<br />
*/<br />
$total = 0; // Declare total variable<br />
$sql=&quot;SELECT column FROM your_table&quot;; // SQL statement to run<br />
$result=mysql_query($sql); // Query database</p>
<p>// Loops through query result and adds each value to $total<br />
while ($row = mysql_fetch_array($result)) {<br />
	$total = $total + $row[column];<br />
}<br />
echo $total; // Prints total to screen<br />
?&gt;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: plankton</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-2062</link>
		<dc:creator>plankton</dc:creator>
		<pubDate>Sun, 19 Nov 2006 22:23:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-2062</guid>
		<description>How about this ...

I query a DB where currency is stored as a varchar(10) and I want to add up the total in my php script.  What do I do then?</description>
		<content:encoded><![CDATA[<p>How about this &#8230;</p>
<p>I query a DB where currency is stored as a varchar(10) and I want to add up the total in my php script.  What do I do then?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Denny</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-120</link>
		<dc:creator>Denny</dc:creator>
		<pubDate>Mon, 24 Apr 2006 05:20:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-120</guid>
		<description>echo "\$" . $formatted;

Since you're using the dot concatenation operator, you might as well eliminate the need to scan through the double-quoted string, like so --

echo '$' . $formatted;

If you use single quotes, PHP won't attempt to parse the string. It will simply take it as it is. This is only a tiny bit more efficient of course, but little things do tend to add up. Besides, why be inefficient when you can be efficient?  :)</description>
		<content:encoded><![CDATA[<p>echo &#8220;\$&#8221; . $formatted;</p>
<p>Since you&#8217;re using the dot concatenation operator, you might as well eliminate the need to scan through the double-quoted string, like so &#8211;</p>
<p>echo &#8216;$&#8217; . $formatted;</p>
<p>If you use single quotes, PHP won&#8217;t attempt to parse the string. It will simply take it as it is. This is only a tiny bit more efficient of course, but little things do tend to add up. Besides, why be inefficient when you can be efficient?  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Foxy</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-119</link>
		<dc:creator>Foxy</dc:creator>
		<pubDate>Fri, 14 Apr 2006 05:54:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-119</guid>
		<description>What about none-standard currency?

Say I return 1347870 from a database query and wish to print it as: 134.78.70 ?</description>
		<content:encoded><![CDATA[<p>What about none-standard currency?</p>
<p>Say I return 1347870 from a database query and wish to print it as: 134.78.70 ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Kelley</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-25</link>
		<dc:creator>Bill Kelley</dc:creator>
		<pubDate>Fri, 10 Mar 2006 04:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-25</guid>
		<description>Thanks for your help..excellent snipplet!</description>
		<content:encoded><![CDATA[<p>Thanks for your help..excellent snipplet!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad R. Smith</title>
		<link>http://www.christopherjason.com/articles/format-money-currency-php/#comment-5</link>
		<dc:creator>Chad R. Smith</dc:creator>
		<pubDate>Tue, 01 Nov 2005 15:05:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.christopherjason.com/articles/formatting-money-currency-using-php/#comment-5</guid>
		<description>Very quick and to the point.  Well written and has helped me get this little issue solved.

Chad R. Smith
Director of Web Development
www.50marketing.com</description>
		<content:encoded><![CDATA[<p>Very quick and to the point.  Well written and has helped me get this little issue solved.</p>
<p>Chad R. Smith<br />
Director of Web Development<br />
<a href="http://www.50marketing.com" rel="nofollow">http://www.50marketing.com</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
