How to write these java code into php?
<p>How to write these java code into php? i wished to compare the date and time using if else~
if the date is within a to b, then perform action</p>

<pre><code>SimpleDateFormat parser = new SimpleDateFormat("HH:mm");
Date ten = parser.parse("10:00");
Date eighteen = parser.parse("18:00");

try {
    Date userDate = parser.parse(someOtherDate);
    if (userDate.after(ten) &amp;&amp; userDate.before(eighteen)) {
        ...
    }
} catch (ParseException e) {
    // Invalid date was entered
}
</code></pre>
