> Ok for the question. I was under the impression that PHP would
> automatically
> select the type for the vars to use. However if I have a field in my form
> where I insert only a 4 in I'd expect the var to be an integer
> (or atleast
> some other whole number type of var). However is_int fails on the
> 4 and sees
> it as a string. So how am I going to check whether it's nothing
> but digits
> [0-9]. The field can hold 4 characters but they don't neccesarily
> need to be
> filled. So the input could be 1 through 9999. Now I could check
> with > or <
> but that won't work since they would still eval true if they'd
> enter 3a. Ok
> it would fail if they'd enter a3 but that still leaves a
> possibility to crash
> my script with 3a. Perhaps somebody could hand me a nice regexp or
> something... I'm not yet familiar with those.

Try this

// checks wether a variable is a n integer of a certain length
// $var = variable to check
// $len = length
function check_int($var,$len)
                return 1;
                return 0;

or remove the  {$len} to not check for a length

> Kind regards and have a nice weekend.

Thanks I will


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to