Re: problem with intval and !=
| From: | Greg Beaver | Date: | Thu, 23 Oct 2003 16:28:22 +0000 |
| Subject: | Re: problem with intval and != | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167310@lists.php.net to get a copy of this message | ||
Hello all,
http://www.php.net/is_numeric
is the function you are looking for. No need for fancy regexps.
Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org
Cesar Cordovez wrote:
Sorry, typo, this is what I meant, !is_integer("12thisisnotanumber") retuns true. but also, is_integer("12") return false. therefore, is_integer(12) return true. So, how can I check if what ever the user writes is an integer or not, knowing that he will write it in a string field. Any how, I solved the problem with preg_match("/^([0-9]+)$/", $value) Thanks for your help, list!!!! =) Robert Cummings wrote:On Thu, 2003-10-23 at 11:41, Cesar Cordovez wrote:Because is_integer("12thisisnotanumber") retuns true.Not for me it doesn't. Returns false. Prolly because it's a string. Even the following returns false for me:is_integer("12")Cheers, Rob.