title: Format money for display: "x" -> "x.00"?
body: <p>I am storing money in MySQL with float format but <code>.00</code> are removed since they don't have much meaning but I want to show them to user in a correct money format using PHP.</p>
  
  <p>I wrote a function which checks whether the money field has any <code>.</code> period otherwise add <code>.00</code>.</p>
  
  <p>But personally I didn't like this function so I am looking for a built-in function which can do the same job:</p>
  
  <pre><code>function formatMoney($price){
      if (strpos($price,".") &gt; -1)
          return $price;
      else
          return $price . ".00";
  }
  </code></pre>
  
  <p><strong>Edit:</strong> For the people who somehow reached my question should know that <code>money_format</code> doesn't work on Windows Machines as it is explained here below taken from the PHP Manual:</p>
  
  <blockquote>
    <p>The function money_format() is only defined if the system has strfmon
    capabilities. For example, Windows does not, so money_format() is
    undefined in Windows.</p>
  </blockquote>
  
  <p>So you should use <code>number_format</code> in place of it. You can see my answer on how I solved this problem.</p>