title: How to use timespan in PHP?
body: <p>I've got 2 fields to populate: how many times the page is called per 15 minutes and per hour.</p>
  
  <p>Following fields are DateTime in MySql:</p>
  
  <pre><code>$lastAccess15m=$row['lastAccess15m'];
  $lastAccessHour=$row['lastAccessHour'];
  </code></pre>
  
  <p>And these fields are ints:</p>
  
  <pre><code>$accessPer15m=$row['accessPer15m'];
  $accessPerHour=$row['accessPerHour'];
  </code></pre>
  
  <p>I want to compare current time with <code>$lastAccess15</code>, and if the time distance is larger than 15 minutes, set the value of <code>$lastAccess15</code> to current time, and reset <code>$accessPer15m</code>, otherwise, increment <code>$accessPer15m</code>. The same goes for <code>$lastAccessHour</code> and <code>$accessPerHour</code>, after which those values have to be saved to mysql database.</p>
  
  <p>How do I get the timespan between current time and $accessPer15m in minutes/hours?</p>