title: PHP time conversion
body: <p>Is there a PHP library that will convert a unix timestamp into something like this format:</p>
  
  <pre><code>8 hours and 17 minutes ago
  </code></pre>
  
  <p>I made my own script a while back that did this, I just can't track it down and would rather not spend the time recreating it (plus I think it could have been done far more efficiently).</p>
  
  <p>My original code was something along the lines of:</p>
  
  <pre><code>$seconds = time() - $timestamp;
  
  $minutes = 0;
  $hours = 0;
  $days = 0;
  $weeks = 0;
  $months = 0;
  $years = 0;
  
  while($seconds &gt;= 60)
  {
      $seconds -= 60;
      $minutes ++;
  
      if($minutes &gt;= 60)
      {
          $minutes -= 60;
          $hours ++;
  
          if($hours &gt;= 24)
          {
              // etc
          }
      }
  }
  
  if($hours &lt; 1) return "$minutes minute" . ($minutes == 1 ? "" : "s")) . " and $seconds seconds" . ($seconds == 1 ? "" : "s"));
  if($minutes &lt; 1) return "$seconds second" . ($seconds == 1 ? "" : "s"));
  
  // etc
  </code></pre>
  
  <p>Better yet, if there's a nicer way to approach the above I'll give it a crack myself as well.</p>