Two Decimal Places Not Showing Leading Zeros in Prices Without Cents

I’m having some trouble showing leading zeros on numbers that display a whole price. For example, if the price is $175.72, then it shows correctly as $175.72. But if I have an amount of $175.00, the display on the page is only $175. I would like the trailing zeros for prices that have .00 as cents.

if ($show_price) {			
					$db->setQuery("SELECT REPLACE(REPLACE(C.currency_positive_style,'{symbol}',C.currency_symbol ),'{number}',cast(P.product_price as decimal(19,2))) As pricetext
                                             FROM
                                             #__virtuemart_product_prices as P
                                             LEFT JOIN
                                             #__virtuemart_currencies as C on C.virtuemart_currency_id = P.product_currency
                                             WHERE P.virtuemart_product_id = '" . $product_id . "'  LIMIT 1 ");


                                        $price_object = $db->loadObject();
										
					//var_dump($pr->prices);
					
					$price = $pr->prices['salesPrice'];
					
					$price = '<div class="productPrice">Retails'.$price_object->pricetext.round($pr->prices,2).'</div>'.'<div class="salesPrice">Sale:'.round($pr->prices['salesPrice'],2).'</div>';

It’s the ‘Sale’ price that is not showing trailing zeros.

What do I do in this situation?

Try this: echo sprintf(“%1.2f”, $money)
($money is whatever money value you were wanting to output)
Hope that helps.

That was awesome! It worked great! Thank you dresden_phoenix!