Store date and system date comparison in php
<p>I have store date in dd-mm-yy and I am getting system date by date(d.m.y).
So I have to compare this two values and have to find out which one is greater.
The following code is not working correctly if I change the end date. I need to compare in Javascript also.
I have written this</p>

<pre><code>$day=date("d");
$month=date("m");
$year=date("y");
$year="20".$year;

$enddate='31-11-2011';
$end=explode("-",$enddate);
$end_day=$end[0];
$end_month=$end[1];
$end_year=$end[2];
$allow=0;
if($year&lt;=$end_year)
{
 if($month&lt;=$end_month)
 {
   if($day&lt;=$end_day)
   {
    $allow=1;
   }
   else
   {
    $allow=0;
   }
 }
 else
 {
 $allow=0;
 }
}
else
{
 $allow=0;
}

if($allow==0)
{
 echo "expired";
}
else
{
 echo "Active";
}
</code></pre>
