You can take a look into is_numeric () (http://www.php.net/is_numeric). It will tell you whether the value is a number or a numeric string, but it will also return true if the value is a float. However, at that point you know your working with the right type of variable.
Jordan S. Jones
Cesar Cordovez wrote:
Sorry, typo, this is what I meant,
!is_integer("12thisisnotanumber") retuns true.
but also,
is_integer("12") return false.
therefore,
is_integer(12) return true.
So, how can I check if what ever the user writes is an integer or not, knowing that he will write it in a string field.
Any how, I solved the problem with preg_match("/^([0-9]+)$/", $value)
Thanks for your help, list!!!!
=)
Robert Cummings wrote:
On Thu, 2003-10-23 at 11:41, Cesar Cordovez wrote:
Because is_integer("12thisisnotanumber") retuns true.
Not for me it doesn't. Returns false. Prolly because it's a string. Even the following returns false for me:
is_integer("12")
Cheers, Rob.
-- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.com&item_name=Jordan+S.+Jones&no_note=1&tax=0¤cy_code=USD
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php