note 22069 added to ref.strings
| From: | jewfish at jewfish dot net | Date: | Wed, 05 Jun 2002 15:20:57 +0000 |
| Subject: | note 22069 added to ref.strings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31489@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/ref.strings.php
http://master.php.net/manage/user-notes.php?action=edit+22069
http://master.php.net/manage/user-notes.php?action=delete+22069
http://master.php.net/manage/user-notes.php?action=reject+22069