I have the array of dates below
array(5) {
[0]=> string(19) \"2012-06-11 08:30:49\"
[1]=> string(19) \"2012-06-07 08:03:54\"
[2]=> st
$arrayy = array(
"2012-06-11 08:30:49","2012-06-07 08:03:54","2012-05-26 23:04:04",
"2012-05-27 08:30:00","2012-06-08 08:30:55"
);
function getMostRecent($array){
$current = date("Y-m-d h:i:s");
$diff1 = NULL;
$recent = NULL;
foreach($array as $date){
if($diff = strcmp($current,$date)){
if($diff1 == NULL){
$diff1 = $diff;
$recent = $date;
}
else{
if($diff < $diff1){
$diff1 = $diff;
$recent = $date;
}
}
}
}
return $recent;
}