Posted By

mail_json on 08/24/06


Tagged

form validation integer isinteger


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

postNuKe


isInteger


 / Published in: PHP
 

  1. function isInteger($n) {
  2. if (preg_match("/[^0-^9]+/",$n) > 0) {
  3. return false;
  4. } return true;
  5. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: stevephp on September 9, 2009

simplified version of the above

function isInteger($n) { return !preg_match("#\D#",$n) ; }

steve db forums

You need to login to post a comment.