note 22069 deleted from ref.strings by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 15 Sep 2004 20:48:57 +0000 |
| Subject: | note 22069 deleted from ref.strings by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76795@lists.php.net to get a copy of this message | ||
Note Submitter: jewfish at jewfish dot net
----
One could make an ever quicker isalphanumeric() function by using regular expressions:
function isalphanumeric($test) {
return !(preg_match("/[^a-z,A-Z,0-9 ]/", $test));
}
Note: that is a space after the 9, in order to inclue spaces in the comparison. One could also add
\t and \n so that it did not fail out if it found a tab or newline. This is much cleaner and more
efficient than the array approach described earlier, and nicer than the ordinal characters approach
as well.