title: Php only numbers Validating function
body: <p>I would like to create a validate function for numbers only, actually I have those ones that works fine, and I tried to create one myself, but it's unfortunately not working. Here are the alphanumeric and others working fine :</p>
  
  <pre><code>// Validators
  private function custom($validator, $value)
  {
      return call_user_func($validator, $value, $this-&gt;request, $this-&gt;id);
  }
  
  private function alphanumeric($value, $custom)
  {
      return preg_match('/^(['.$custom.'a-z0-9_]*)$/i', $value);
  }
  
  private function valid_email($value)
  {
      return preg_match('/^\S+@\S+\.\S+$/', $value);
  }
  </code></pre>
  
  <p>And the one I tried to create by modifying the alphanumeric one : </p>
  
  <pre><code>private function numbers_only($value, $custom)
  {
      return preg_match('/^(['.$custom.'0-9_]*)$/i', $value);
  }
  </code></pre>
  
  <p>What's wrong with this one ?</p>
  
  <p>EDIT :
  I also have a JS helping with the form, for alphanumeric it's : </p>
  
  <pre><code>Form.prototype.alphanumeric = function(value, custom)
  {
      return !value.replace(new RegExp('['+custom+'a-z0-9_]', 'ig'), '').length;
  };
  </code></pre>
  
  <p>What would be the JS for numeric only ?</p>