Re: How to find if a string is an integer?

From: Date: Thu, 12 Jun 2003 19:31:30 +0000
Subject: Re: How to find if a string is an integer?
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-151291@lists.php.net to get a copy of this message
> <snip> > > Sorry, I don´t know that you needed an effective snipet. And you are > > right, > > I only writed for positive integers. Try something like apply 2 type cast > > simunltaneous. > > > > if ( (string) ((int) $_POST["var_int"]) == $_POST["var_int"]) > > echo "is int"; > > > > > Why not just use the is_int() function? > > www.php.net/is_int Please try to use is_int() on a value passed from a form and see why. Also, in the beginning of this thread, the OP already said that is_int() had been tried. ---John Holmes...

« previous php.general (#151291) next »