Posted by Martin on 11/15/44 11:23
Can someone please explain to me how I can check (in my PHP script)
whether a user input is a number or not?
I thought it would be as simple as:
if(is_nan($myinputfield)){ then do something }
but that doesn't seem to work.
The PHP docs say that the value being passed to the is_nan function is
defined as a float_val. Wouldn't this mean then, by definition, that
it is a number? Can I pass a string to it?
I'm very confused...
Navigation:
[Reply to this message]
|