...

View Full Version : Needs help with this!



Idfk
12-07-2010, 09:08 PM
<?php
function ago($timestamp){
$difference = time() - $timestamp;

if($difference < 60)
return $difference." seconds ago";
else{
$difference = round($difference / 60);
if($difference < 60)
return $difference." minutes ago";
else{
$difference = round($difference / 60);
if($difference < 24)
return $difference." hours ago";
else{
$difference = round($difference / 24);
if($difference < 7)
return $difference." days ago";
else{
$difference = round($difference / 7);
return $difference." weeks ago";
}
}
}
}
}
?>


Doing my head in its in my core file & i want to echo it like this
echo $core->timestamp($posts['timestamp']);
so it change's to

about 1 min ago

etc same as facebook lol thanks.

Or something like facebook's been trying to find one but cant at all :L and i'll still learning php lol!

syncupsolutions
12-07-2010, 09:11 PM
Not really sure what your asking here. I dont see any problem with that code.

Idfk
12-07-2010, 09:20 PM
Fixed it & thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum