Hi
Can anyone help me how to fix below problem, it will hangs. How to do do
example 2min ago??
function ago($timestamp){
$difference = time() - $timestamp;
if ($difference >=(5 * 60 * 60) && $difference<=(24 * 60 * 60) ) {
return ('Today');
}
$periods = array("second", "minute", "hour", "day", "week", "month", "years", "decade");
$lengths = array("60","60","24","7","4.35","12","10");
for($j = 0; $difference >= $lengths[$j]; $j++)
$difference /= $lengths[$j];
$difference = round($difference);
if($difference != 1) $periods[$j].= "s";
$text = "$difference $periods[$j] ago";
return $text;
}