title: How do I compare two DateTime objects in PHP 5.2.8?
body: <p>Having a look on the PHP documentation, the following two methods of the <code>DateTime</code> object would both seem to solve my problem:</p>
  
  <ul>
  <li><a href="http://au.php.net/manual/en/datetime.diff.php" rel="noreferrer">DateTime::diff</a> : Get the difference and use that to determine which is more ancient.</li>
  <li><a href="http://au.php.net/manual/en/datetime.gettimestamp.php" rel="noreferrer">DateTime::getTimestamp</a> : Get the UNIX timestampt and compare those.</li>
  </ul>
  
  <p>Both these methods are marked in the <a href="http://au.php.net/datetime" rel="noreferrer">doco</a> as being available in version >= 5.3 (and, not surprisingly, if I try to call them I find they don't exist). I can't find any specific documentation for 5.2.8 so I am not sure if there are equivalent methods in my version.  I have <a href="http://www.google.com.au/search?q=compare+DateTime+PHP&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" rel="noreferrer">Googled</a> the problem and found an eclectic range of solutions, none of which answer my very simple requirements:</p>
  
  <ul>
  <li>How do I compare two DateTime objects?</li>
  <li>Where can I find the doco for previous PHP versions? Specifically version 5.2.8?</li>
  </ul>
  
  <p>For some context, I have the following code:</p>
  
  <pre><code>$st_dt = new DateTime(verifyParam ('start_date'));
  $end_dt = new DateTime(verifyParam ('end_date'));
  
  // is the end date more ancient than the start date?
  if ($end_dt &lt; $start_dt) 
  </code></pre>
  
  <p>Apparently there is no comparison operator on this guy.  </p>
  
  <h2>Edit</h2>
  
  <p><em>Apparently</em> my assumptions were completely false (thanks Milen for illustrating this so effectively).  There is a comparison operator and it works just fine thanks.  Sometimes I really miss a compiler.  The bug is in the code above, I am sure you will find it much faster than I did :).</p>