Why not just use a regular expression match to see if there is anything
other than numeric characters? That will tell you if it is an integer before
you do the type casting.

(sorry if that sounds a little obvious but no-one seems to have suggested
it)

- Dan

"Unknown Sender" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
>
> This may be a silly question, but I can't spot and easy way to do it, I
> want to check if the value inside a vriable is an integer. If I do
> is_int($variable) I always get false, because this variable qwas read in
> from a form so its a string, if I make the variable an integer using
> settype() I just end up with 0 if it was invalid, the number otherwise. I
> need something that will actually tell me if there the conversion was
> successfull. Am I missing something?
>
> Thanks,
> Shaun
>



-- 
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