Citation :
One could make an ever quicker isalphanumeric() function by using regular expressions:
function isalphanumeric($test) {
return !(preg_match("/[^a-z,A-Z,0-9 ]/", $test));
}
Note: that is a space after the 9, in order to inclue spaces in the comparison. One could also add \t and \n so that it did not fail out if it found a tab or newline. This is much cleaner and more efficient than the array approach described earlier, and nicer than the ordinal characters approach as well.
|