title: How to validate if input is only a number? intval and is_init not working
body: <p>I need to validate if value that user inserted in input field is only a number. The input field is for a price so only the valid numbers should be accepted from 0 to 9 and i would also avoid decimal points.</p>
  
  <p>So after reading around i figured out maybe i can use <code>intval</code> to return integer of input value and later on to compare if <code>is_int</code> to see if input is only integer. I wanted to avoid <code>is_numeric</code> because that can return true for code like this <code>+0123.45e6</code></p>
  
  <p>But i have no luck, somehow it doesn't work as i intended to work. Here is my code that i am trying to validate.</p>
  
  <pre><code>$price = isset($_POST['price']) ? intval($_POST['price']) : '';
  
  if( ($price != '') &amp;&amp; (!is_int($price)) ) { // If price is correct
     $throw_error[] = __( '&lt;strong&gt;ERROR&lt;/strong&gt;: Price must be only number.' );
     $errors = true;
     $price = '';
  }
  </code></pre>
  
  <p>But somehow this fails to validate and some letters like <code>sdadaar</code> can pass the error.</p>