function time_passed($since_ts)
{
$periods = array('years' => 0, 'months' => 0, 'weeks' => 0, 'days' => 0,
'hours' => 0, 'minutes' => 0, 'seconds' => 0);
$current_ts = time();
foreach ($periods as $key => $val) {
while (($ts = strtotime('-1 ' . $key, $current_ts)) > $since_ts) {
$periods[$key]++;
$current_ts = $ts;
}
}
return $periods;
}