Re: problem with intval and !=
| From: | Cesar Cordovez | Date: | Thu, 23 Oct 2003 15:59:44 +0000 |
| Subject: | Re: problem with intval and != | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167305@lists.php.net to get a copy of this message | ||
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.