08-01-2008, 09:28 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
|
Checking if a string is alphanumeric
I was looking for the best way to check if a string is alphanumeric and I found things along the lines of:
PHP Code:
function is_alphanumeric($someString){
return (preg_match("/[\w\s.]/i", $someString) > 0) ? true : false;
}
But then I found the ctype_alnum function for PHP which should I be using?
The second one seems much better to me 
|
|
|