View Single Post
Old 08-01-2008, 09:28 AM   #1 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default 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
__________________
Free CSS Tutorials
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote