JS to PHP conversion
<p>I've got an old JS script to retrieve my last tweet and display the date in a « X minutes ago » fashion. I want to convert it to PHP and, in the process, improve/optimize it if possible :</p>

<pre><code>var dateAct = new Date();        
var diff = dateAct.getTime() - dateTwit.getTime();       
var min = (diff/(1000*3600))*60; 
var result; var sec;
var y = i+1; var z; var k;

if (min &lt; 0) result = 'recently'
else if (min &lt; 1) { sec = (diff/(1000*3600))*60*60; result = Math.round(sec) + ' seconds ago'; }
else if (min &lt; 60) result = Math.round(min) + ' minutes ago';
else if (min &lt; 120) result = 'about an hour ago';
else if (min &lt; 1440 ) { var hours = Math.round(min/60); result = 'about ' + hours + ' hours ago'; }
else { 
var days = Math.round(min/1440); 
if (days &lt; 365) result = 'about ' + days + ' day(s) ago'; 
else result = 'over a year ago'; 
}
</code></pre>
