> -----Original Message----- > From: Alex Earl [mailto:[EMAIL PROTECTED] > Sent: 12 June 2003 21:13 > > > 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.
Just a little nitpick here, but 4e4 is not hex but scientific notation representing 40,000. 0x4e4 would be a hex value representing, ooooh, a little over 1200 at a rough guess. I'm pretty sure both of these have been suggested, but personally I'd go for either a pattern match or something like: if ((string)($value+0)===$value) Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php