title: PHP number format drops zero when rounding
body: <p>I'm using PHP's number_format to display floats to 2 decimal places. </p>
  
  <p>When the number is something like 1.898 it gets rounded up to 1.9.  </p>
  
  <p>How do I get it to display that as 1.90?</p>
  
  <p>Update:</p>
  
  <p>I have a function that ends...</p>
  
  <pre><code>return number_formant($num, 2);
  </code></pre>
  
  <p>The php script that calls the function prints out the number to be used by Javascript.  When I do a var_dump on the number, it prints correctly with two decimal places. Looks like it's Javascript that's loosing the zero.</p>
  
  <p>Here's the JS code that was causing the issue...</p>
  
  <pre><code>function show_level(level) {
  ...
  if (level &gt; 9999)
      level_label = (level / 1000).toPrecision(3) + 'k';
  else if (level &gt; 999)
      level_label = (level / 1000).toPrecision(2) + 'k';
  else
      level_label = level;
  </code></pre>
  
  <p>I altered the last line to get it working how I wanted..</p>
  
  <pre><code>  level_label = level.toFixed(2);
  </code></pre>