I need to find the maximum and minimum date from a given array using PHP.
I have $date_arr which contains following values,
$date_arr = array(\'0\'
'20-05-2015',1=>'02-01-2015',2=>'30-03-2015'); usort($date_arr, function($a, $b) { $dateTimestamp1 = strtotime($a); $dateTimestamp2 = strtotime($b); return $dateTimestamp1 < $dateTimestamp2 ? -1: 1; }); echo 'Min: ' . $date_arr[0]; echo ''; echo 'Max: ' . $date_arr[count($date_arr) - 1]; ?>