Re: How to find if a string is an integer?
| From: | Jean-Christian IMbeault | Date: | Thu, 12 Jun 2003 01:52:08 +0000 |
| Subject: | Re: How to find if a string is an integer? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151184@lists.php.net to get a copy of this message | ||
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