title: Calculate difference in hours PHP
body: <p>
  I am trying to write a PHP code to count publishing time-lapse. I have a date and time in this format: Sun, 03 Dec 2017 12:45:09 GMT ($pub_time). </p>
  
  <p>
  My code:   </p>
  
  <pre><code>$timestamp=  strtotime($pub_time) ;
  $minutes = floor((strtotime('now') - $timestamp)/ 60);
  if  ($minutes &lt; 60) {
      return $time_string = $minutes . ' minutes ago';
  } else {
      return $time_string = floor(($minutes) / 60) . ' hours ago';
  }
  </code></pre>
  
  <p>
  As a result I need to get smth like this : "4 hours ago".</p>
  
  <p>
  Using my code I get this result - 420104.58333333 hours ago, whatever input date there is. Any thoughts?</p>