title: Days, hours, minutes since timestamp
body: <p>So I have this function, which displays how long it's been since a timestamp.</p>
  
  <p>Right now if it's been let's say 60 minutes, it will go over and show "1 hour ago". If it's been 24 hours it goes over to "1 day ago" and so on. How could I do so that if it's been for example 1 hour, show minutes also?</p>
  
  <p>Like</p>
  
  <pre><code>Event occured 58 minutes ago
  3 minutes later
  Event occured 1 hour 1 minute ago
  26 hours later
  Event occured 1 day 2 hour ago
  
  
  
  
  function humanTiming($time) 
  {
  
  $time = time() - $time; // to get the time since that moment
  
  $tokens = array (
      31536000 =&gt; 'year',
      2592000 =&gt; 'month',
      604800 =&gt; 'week',
      86400 =&gt; 'day',
      3600 =&gt; 'hour',
      60 =&gt; 'minute',
      1 =&gt; 'second'
  );
  
  foreach ($tokens as $unit =&gt; $text) {
      if ($time &lt; $unit) continue;
      $numberOfUnits = floor($time / $unit);
      return $numberOfUnits.$text.' ago';
  }
  
  }
  </code></pre>