Re: Integer check...

From: Date: Wed, 17 Oct 2001 12:22:26 +0000
Subject: Re: Integer check...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-71329@lists.php.net to get a copy of this message
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

« previous php.general (#71329) next »