numeric and alphanumeric
Posted on 2001-06-22
I looked for this in the PHP manual on PHP.net, but I don't find what I'm looking for (maybe I looked over it).
Basically, what I need is a way to identify whether or not a submitted value contains alphanumeric characters. It would be even better if those characters could be stripped from the string.
For example, when a user fills in a form field and enters "dfdg2435", the script will return an error because only numbers are allowed. If it could also remove the "dfdg" part, that would be very nice.
I can always search a string for characters with for instance strstr(), and then even remove the string, but that obviously is no practical solution if you've got a whole collection of ASCII (and other) characters to deal with.