How to get int instead string from form?

Getting variable from form:

<form method = 'POST' action = ''>
        <input type = 'text' name = 'a' size = '1' >
        <input type = 'submit' value = 'Find it'>
</form>"

If I enter 1 and use gettype($POST_['a']) it returns me string, is it possible to enter int? because after this I want check if that variable is int.

UPDATE

Got answers that it returns always string and they offered me to use (int) or intval(), but then if it's really string like 'a' it returns 0, but it may be also integer value 0, how to overcome this problem?

UPDATE

After editing typo Brad Christie suggested best way, using is_numeric

20
задан Templar 13 December 2012 в 03:21
поделиться