PHP: multilingual Time::since() static class
I've not coded any PHP in last five years but if I'm right the following is the same:

$tokens = array (
    31536000 =&gt; array('msgid1' =&gt; "Last visit: %d year ago", 
        'msgid2' =&gt; "Last visit: %d years ago"),
    2592000 =&gt; array('msgid1' =&gt; "Last visit: %d month ago", 
        'msgid2' =&gt; "Last visit: %d months ago"),
    604800 =&gt; array('msgid1' =&gt; "Last visit: %d week ago", 
        'msgid2' =&gt; "Last visit: %d weeks ago"),
    86400 =&gt; array('msgid1' =&gt; "Last visit: %d day ago", 
        'msgid2' =&gt; "Last visit: %d days ago"),
    3600 =&gt; array('msgid1' =&gt; "Last visit: %d hour ago", 
        'msgid2' =&gt; "Last visit: %d hours ago"),
    60 =&gt; array('msgid1' =&gt; "Last visit: %d minute ago", 
        'msgid2' =&gt; "Last visit: %d minutes ago"),
    1 =&gt; array('msgid1' =&gt; "Last visit: %d second ago", 
        'msgid2' =&gt; "Last visit: %d seconds ago")
);

foreach ($tokens as $unit =&gt; $data) {
    if ($time &lt; $unit) {
        continue;
    }
    $numberOfUnits = floor($time / $unit);

    $formatString = ngettext($data['msgid1'], $data['msgid2'], $numberOfUnits);
    return sprintf($formatString, $numberOfUnits);
}


I think you should handle 0 too. Currently it prints nothing for this input.