On Wed, 20 Oct 2004, Markus Ernst wrote:
Cyrus D. wrote: I want to validate a string to make sure it contains only digits.
An alternative suggestion without regexps:
is_numeric($string) && strval(floor(intval($string))) == $string
Checks if $string is numeric; and then removes possible decimal places and
compares that to the original (to make sure there are no points).
Technically this will also allow strings which begin with "-" or "+", and
those which contain a "." followed solely by zeros. This might be what is
required, though.
--
Matt