I have this function that includes an array of tokens for time:
function TimeAgo($time, $ret = '') {
$time = time() - strtotime($time); // to get the time since that moment
$tokens = array (
'year' => 31536000,
'month' => 2592000,
'week' => 604800,
'day' => 86400,
'hour' => 3600,
'minute' => 60,
'second' => 1
);
}
I am going to check if $ret
equals one of the names in the array (year, month etc.) and if it does, I want to convert $time
to the selected
How can I convert $time
to one of the tokens?