Comparing two dates
<p>How can I compare two dates in PHP?</p>

<p>In the database, the date looks like 2011-10-2.</p>

<p>If I wanted to compare today's date against the date in the database to see which one is greater, how would I do it?</p>

<p>I tried this,</p>

<pre><code>$today = date("Y-m-d");
$expire = $row-&gt;expireDate //from db

if($today &lt; $expireDate) { //do something; }
</code></pre>

<p>but it doesn't really work that way. What's another way of doing it? </p>
