 <p>According to <a href="http://www.php.net/manual/en/function.is-numeric.php">http://www.php.net/manual/en/function.is-numeric.php</a>, is_numeric alows something like "+0123.45e6" or "0xFF". I think this not what you expect.</p> <p>preg_match can be slow, and you can have something like 0000 or 0051.</p> <p>I prefer using ctype_digit (works only with strings, it's ok with $_GET).</p> <pre><code>&lt;?php $id = $_GET['id']; if (ctype_digit($id)) { echo 'ok'; } else { echo 'nok'; } ?&gt; </code></pre>