ctype_alnum()
This function checks if every character of the string given is an alphanumeric character. “Alphanumeric” is defined by the locale as it is set at the time of calling.
In English, it’s equivalent to upper and lower case plus numeric characters but some languages have characters which are alphabetic but neither upper nor lower case. Be sure to see the introduction to ctype functions.
Keep in mind that every character is looked at. Even whitespace will result in FALSE.
$res = ctype_alnum( 'MONKEY' ); // true $res = ctype_alnum( 'Monkey' ); // true $res = ctype_alnum( 'apple1234u' ); // true $res = ctype_alnum( 'apple 1234' ); // false $res = ctype_alnum( 'LOOK_AT_ME' ); // false $res = ctype_alnum( 'HI THERE' ); // false
See the manual entry for ctype_alnum()
