title: How to calculate the difference of two dates
body: <p>I have two dates assigned in variable $date1 and $date2..
  Here is the code..</p>
  
  <pre><code>if (isset($_POST['check_in']))
  {
   $date1=date('Y-m-d', strtotime($_POST['check_in']));
  }
  if (isset($_POST['check_in']))
  {
   $date2=date('Y-m-d', strtotime($_POST['check_out']));
  }
  </code></pre>
  
  <p>For example if <code>date1="2015-05-21"</code> and <code>date2="2015-05-23"</code>.I want the difference of date as 2</p>