Check Expire Validity by PHP

<?php
/*compare tow date which is expire or not
*Make sure the given tow date in same format
*/
function compareDates($date1,$date2) {
$date1_array = explode("-",$date1);
$date2_array = explode("-",$date2);
$timestamp1 = mktime(0,0,0,$date1_array[1],$date1_array[2],$date1_array[0]);
$timestamp2 = mktime(0,0,0,$date2_array[1],$date2_array[2],$date2_array[0]);
if ($timestamp1>$timestamp2) {
return 1;
} else if ($timestamp1<$timestamp2) {
return 2;
} else {
return 0;
}
}
$end_date = '2010-06-15';
$today = date("Y-m-d");
$result = compareDates($end_date,$today);
if($result==0) echo "This is the Last day of Expired.";
if($result==1) echo "The date is Not Expired and You have more time";
if($result==2) echo "The date is Expired";
?>