'${time_ago_year}', 30 * 24 * 60 * 60 => '${time_ago_month}', 24 * 60 * 60 => '${time_ago_day}', 60 * 60 => '${time_ago_hour}', 60 => '${time_ago_minute}', 1 => '${time_ago_second}'); foreach ($a as $secs => $str){ $d = $etime / $secs; if ($d >= 1){ $r = round($d); return $r . ' ' . $str;} } } }