Mega Code Archive

 
Categories / Php / Strings
 

Integer displayed as a dollar amount set to two decimal places

<?php      $thenumber = 9.99 * 1.07;      echo "$" . $thenumber . "<br />";      echo "$" . sprintf ("%.2f", $thenumber);  ?>