Re: How to find if a string is an integer?
| From: | António Rafael Paiva | Date: | Fri, 13 Jun 2003 10:23:45 +0000 |
| Subject: | Re: How to find if a string is an integer? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151346@lists.php.net to get a copy of this message | ||
Why don't you write your own test function since it's getting so hard to find one. All you have to do is check if the string only has number characters.
I would say this is a simple task!
Good luck,
Rafael
On Thu, 12 Jun 2003 13:13:28 -0700 (MST)
"Alex Earl" <slide@duke-of-earl.com> wrote:
Jumping in a little late here, but what about is_numeric()? Haven't tried it, but the php manual for is_int says: Note: To test if a variable is a number or a numeric string (such as form input, which is always a string), you must use is_numeric(). The problem with is_numeric() is that something like "4e4" comes up as true, because it could be construed as a HEX value. Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php---------------------------------------------------- António Rafael C. Paiva Electronics and Telecommunications Dep. Aveiro University