//
// Generate a time past string
//
function time_past($timestamp, $until='') {
global $lang;
$seconds = ( ( is_int($until) ) ? $until : time() ) - $timestamp;
$times = array();
$sections = array(
'weeks' => 604800,
'days' => 86400,
'hours' => 3600,
'minutes' => 60,
'seconds' => 0 );
foreach( $sections as $what => $length ) {
if ( $seconds >= $length ) {
$times[$what] = ($length >0) ? floor($seconds / $length) : $length;
$seconds %= $length;
}
}
$sections = array();
foreach ( $times as $key => $val )
$sections[] = $val.' '.$lang[ucfirst($key)];
return array($times, join(', ', $sections));
}
_______________
Yep I know me,.. thats that guy ..
> Lets script :: The PtokaX Lua Board :: The PtokaX Script Database
> Lets script :: The PtokaX Lua Board :: The PtokaX Script Database



