Re: string filtering

From: Date: Fri, 27 Aug 2004 16:08:44 +0000
Subject: Re: string filtering
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-194906@lists.php.net to get a copy of this message
John W. Holmes wrote:
To detect them: if(preg_match('/[^0-9a-zA-Z]/',$string)) { echo 'bad characters present'; } else { echo 'string okay'; }
or (faster): if (!ctype_alnum($string)){
    echo 'bad characters present';
} else {
    echo 'string okay';
} Aaron

« previous php.general (#194906) next »