Re: Test whether string is valid integer
From: Rutger Claes (rgc_at_rgc.tld-of-belgium)
Date: 11/11/04
- Next message: Oliver Spiesshofer: "Re: MySQL backup w/o dump?"
- Previous message: Oliver Spiesshofer: "Re: MySQL backup w/o dump?"
- In reply to: Paul E Collins: "Test whether string is valid integer"
- Next in thread: Justin Koivisto: "Re: Test whether string is valid integer"
- Reply: Justin Koivisto: "Re: Test whether string is valid integer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 11 Nov 2004 19:20:19 +0100
Paul E Collins wrote:
> Given a string variable (form input), how can I determine whether it
> represents a valid integer?
>
> is_numeric is true for floats as well as integers, and is_int always
> fails on a string.
>
> P.
intval( $string ) == $string
works for me...
-- Rutger Claes rgc@rgc.tld Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6 >From listening comes wisdom and from speaking repentance.
- Next message: Oliver Spiesshofer: "Re: MySQL backup w/o dump?"
- Previous message: Oliver Spiesshofer: "Re: MySQL backup w/o dump?"
- In reply to: Paul E Collins: "Test whether string is valid integer"
- Next in thread: Justin Koivisto: "Re: Test whether string is valid integer"
- Reply: Justin Koivisto: "Re: Test whether string is valid integer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
Loading