title: PHP Advanced Currency Formatting
body: <p>I was wondering if there is a simple method in PHP to format currency correctly for the following tasks:</p>
  
  <p>If a value is: <code>4.37</code> then the output will be <code>$4.37</code></p>
  
  <p>If a value is: <code>4.00</code> then the output will be <code>$4</code></p>
  
  <p>If a value is: <code>4.3</code> or <code>4.30</code> then the output will be <code>$4.30</code></p>
  
  <p>If a value is <code>0.37</code> then the output will be <code>37¢</code></p>
  
  <p>I'm sure this is quite complicated to do (I'm a beginner in PHP), but if anyone has any suggestions it would be greatly appreciated.</p>