title: Calculate percentage increase between two decimal numbers
body: <p>I have a number of decimal numbers stored in a database and need to calculate the percentage increase(or decrease) between two of the numbers using PHP.</p>
  
  <p>An example of two of the numbers are: 111.0516 and 111.9052 which would be an increase of 0.7628%</p>
  
  <p>I found the following code somewhere. Unfortunately it doesn't seem to work with decimal numbers and rounds them up:</p>
  
  <pre><code>$num_amount = 111.0516;
  $num_total = 111.9052;
  
  function percent($num_amount, $num_total) {
  $count1 = $num_amount / $num_total;
  $count2 = $count1 * 100;
  $count = number_format($count2, 0);
  echo $count;
  }
  
  percent($num_amount, $num_total);
  </code></pre>
  
  <p>Ideally I need to calculate the percentage to two decimal places giving an answer of 0.77%.</p>
  
  <p>Is this possible with PHP? I'm stumped. Neither my PHP or maths skills are good enough to figure it out.</p>