Hello all,

http://www.php.net/is_numeric

is the function you are looking for. No need for fancy regexps.

Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org

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.

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to