title: Php Calculate percentage difference between two numbers
body: <p>I am trying to find the difference of two numbers in percentage. The actual scenario is iam getting a total value of user data for this week and for last week. Now i need to see the performance difference in percentage with this weeks data and last weeks data. Following is my code which i am trying. But at times either any of the data will be zero and am getting an error "Division by zero". How to handle that?</p>
  
  <pre><code>$this_week_cust=$row["cust_count_new"];
  $last_week_cust=$row["cust_count_old"];
  
  $percentChange = (1 - $last_week_cust / $this_week_cust) * 100;
  </code></pre>