|
Posted by Martin on 10/15/61 11:23
On Sun, 07 Aug 2005 19:20:44 -0700, Martin <martinvalley@comcast.net>
wrote:
>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...
Never mind...
I see that what I want is "is_numeric()" rather than "is_nan".
A little less confused now.
Navigation:
[Reply to this message]
|