note 15590 modified in ref.strings by sander
| From: | sander@php.net | Date: | Sun, 07 Apr 2002 13:45:14 +0000 |
| Subject: | note 15590 modified in ref.strings by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28926@lists.php.net to get a copy of this message | ||
while we're waiting that ctype functions get out from experimental phase, look at this
function.
It check if a string contain only alphanumeric characters (a-zA-Z0-9)
function isalphanumstr($string) {
for($i = 0; $i < strlen($string); $i++)
if (!in_array($string[$i],
array("q","w","e","r","t","y","u","i","o","p","l","k","j","h",
"g","f","d","s","a","z","x","c","v","b","n","m","Q","W",
"E","R","T","Y","U","I","O","P","L","K","J","H","G","F",
"D","S","A","Z","X","C","V","B","N","M","0","1","2","3",
"4","5","6","7","8","9"))) {
return false;
} else {
return true;
}
}
--was--
while we're waiting that ctype functions get out from experimental phase, look at this
function.
It check if a string contain only alphanumeric characters (a-zA-Z0-9)
function isalphanumstr($string) {
for($i = 0; $i < strlen($string); $i++)
if
(!in_array($string[$i],array("q","w","e","r","t","y","u","i","o","p","l","k","j","h",
"g","f","d","s","a","z","x","c","v","b","n","m","Q","W",
"E","R","T","Y","U","I","O","P","L","K","J","H","G","F",
"D","S","A","Z","X","C","V","B","N","M","0","1","2","3",
"4","5","6","7","8","9");
return false;
return true;
}
http://www.php.net/manual/en/ref.strings.php