PHP number format with integer format
<p>I am using <code>PHP</code> <code>number_format</code> to express prices of products, using decimal point, thousands separators, etc. For example:</p>

<pre><code>$price = 20.456;
print "$" . number_format($price, 2, ".", ",");
</code></pre>

<p>outputs <code>$20.46</code>.</p>

<p>However, I would like that, if the price is integer, for example <code>$price = 20.00</code>, to output <code>$20</code>. Is there some other function or rule to achieve this, avoiding decimal points if not necessary?</p>