PHP: Shortest way to check if a variable contains positive integer?

Posted by NAVEED on Stack Overflow See other posts from Stack Overflow or by NAVEED
Published on 2010-04-01T11:12:48Z Indexed on 2010/04/01 14:03 UTC
Read the original article Hit count: 293

Filed under:
|
|
|
|

I want to check if user input a positive integer number.

1    = true
+10  = true
.1   = false
-1   = false
10.5 = false


Just a positive number. 
No characters.
No special character.
No dot.
No minus sign.

I tried is_int() function but it is returning false even on positive integers. Is there a string to int problem?

Thanks

© Stack Overflow or respective owner

Related posts about zend

Related posts about php