Re: Integer check...
| From: | Leon Mergen | Date: | Wed, 17 Oct 2001 13:07:28 +0000 |
| Subject: | Re: Integer check... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71334@lists.php.net to get a copy of this message | ||
Hmm.... I just used
if ($value!=intval($value))
{
print ('Man, you really have no idea what an integer is, do you?');
}
----- Original Message -----
From: "liljim" <liljim@liljim.co.uk>
To: "Leon Mergen" <leon@blazebox.com>
Sent: Wednesday, October 17, 2001 2:22 PM
Subject: Re: Integer check...
> Hey Leon,
>
> for ages I used preg_match for a regex match:
>
> if (!preg_match("/^[0-9]+$/", $string)) {
> // That's no number!;
> }
>
> Though it turns out I was missing the is_int() function.
>
> Hope that helps,
>
> James
>
> ----- Original Message -----
> From: "Leon Mergen" <leon@blazebox.com>
> Newsgroups: php.general
> To: <php-general@lists.php.net>
> Sent: Wednesday, October 17, 2001 12:30 PM
> Subject: Integer check...
>
>
> Hello,
>
> I got a little problem... At a script I'm writing, I ask the visitors to
> enter a number... now, they started entering numbers like:
>
> 100E+6
>
> While I have said that the number can't be higher than 95,000,000 ... how
> can I check if this number really is in the format
>
> 100000000
>
> instead of 100E+6? It seems weird, because PHP sees this number as
> 100000000, but when I update a MySQL integer field it is read as 100...
>
> Please help!
>
> Thanks in advance,
>
> Leon Mergen
>
>
>
>
>