title: PHP one digit after decimal point for real numbers and no digits for integer values
body: <p>What is the best solution to convert a number to:</p>
  
  <ol>
  <li>one digit after decimal point if that number is a real number</li>
  <li>no digits, no decimal point if the number is an integer</li>
  </ol>
  
  <p>Example:</p>
  
  <pre><code>if ($num == 8.2) //display 8.2
  if ($num == 8.0) //display 8
  </code></pre>
  
  <p>Note: I won't have numbers like 8.22 or 8.02. I will have this type of numbers:</p>
  
  <p>1, 1.2, 1.4 ... 2.6, 2.8, 3 ....9.8, 10</p>