tags:

views:

385

answers:

2

Is there a Php function to determine if a string consist of only ASCII alphanumerical characters?

Note: I'm sorry if the question sounds dumb to some, but I couldn't easily find such a function in the Php manual.

+6  A: 

Try ctype_alnum

John T
Exactly what I was looking for, thanks!
Robert Gould
+1  A: 
preg_match('/^[a-z0-9]+$/i', $str);

Edit: John T's answer is better. Just providing another method.

eyelidlessness
Thanks anyways, this is a somewhat reasonable alternative.
Robert Gould