Forum Moderators: coopster
thanks
[uk2.php.net...]
ctype_alnum() would return true if all characters in $id are alphanumeric.
Also you should think if an id is definately needed for a page and it isn't passed what will you do? display an error page or redirect to another page?
You might want to check out the notes on the is_numeric [uk.php.net] function on the PHP website:
Finds whether a variable is a number or a numeric string.Numeric strings consist of optional sign, any number of digits, optional decimal part and optional exponential part. Thus +0123.45e6 is a valid numeric value.
Also, someone commented that the is_numeric function will only check 16 digits and no more and that in PHP5 it returns false for strings with a leading decimal point.
The character classes and the ctype functions will check that ALL characters in the string are numeric. I don`t think there would be much speed wise, but for a true numeric check I think those two are better.
dc