How can I verify a year in $_GET["year"] in PHP?
<p>I have a PHP calendar that generates a calendar based on the month and year. I use $_GET["year"]. So, it appears in the URL of the page. Therefore, the user can input any year. How can I verify that the year they entered is a year (like 2010) and not a random input (like 2t8e7sjj2)?</p>

<p>I figured out how to verify month like this:</p>

<pre><code>$m = $_GET["month"];

if($m!=1 &amp;&amp; $m!=2 &amp;&amp; $m!=3 &amp;&amp; $m!=4 &amp;&amp; $m!=5 &amp;&amp; $m!=6 &amp;&amp; $m!=7 &amp;&amp; $m!=8 &amp;&amp; $m!=9 &amp;&amp; $m!=10 &amp;&amp; $m!=11 &amp;&amp; $m!=12)
{
$m = date("m");
}
</code></pre>

<p>But I can't do this with year (since the year could be any number).
Also, is there a better way to verify the month other than above?</p>

<p>Thanks.</p>
