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

From: Date: Thu, 12 Jun 2003 19:49:48 +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-151293@lists.php.net to get a copy of this message
To be honest, I haven't really understood what three of them does... Is it the same value without type casting? "Jean-Christian Imbeault" <jc@mega-bucks.co.jp> skrev i meddelandet news:3EE7DCC8.1010509@mega-bucks.co.jp... > Dvdmandt wrote: > > It's not that killing... :p > > preg_match("#^-?[0-9]+$#",$_POST["var_int"]); > > Not *that's* a mouthful ... > > > I was also thinking about that === operator.. And this: > > if(((string)((int)$_POST["var_int"]))==$_POST["var_int"]) > > Cute. Might actually work too! Wonder if there would be any difference > in using == or === in your suggestion? > > Jc >

« previous php.general (#151293) next »