

ID: 118
Viewed: 3610
Added: Apr 14, 2002
Version:



Snippet uploaded by: Unknown
Written By: Ric Mitchell
Demo: Sorry, no demo



Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty


This is a function, that will return false if the string passed to it is not alphanumeric, and true if it is.
<!---Head--->
none
<!---Body--->
<?
function alphanumeric($string) {
$alphachars[0] = "9";
$alphachars[1] = "a";
$alphachars[2] = "b";
$alphachars[3] = "c";
$alphachars[4] = "d";
$alphachars[5] = "e";
$alphachars[6] = "f";
$alphachars[7] = "g";
$alphachars[8] = "h";
$alphachars[9] = "i";
$alphachars[10] = "j";
$alphachars[11] = "k";
$alphachars[12] = "l";
$alphachars[13] = "m";
$alphachars[14] = "n";
$alphachars[15] = "o";
$alphachars[16] = "p";
$alphachars[17] = "q";
$alphachars[18] = "r";
$alphachars[19] = "s";
$alphachars[20] = "t";
$alphachars[21] = "u";
$alphachars[22] = "v";
$alphachars[23] = "w";
$alphachars[24] = "x";
$alphachars[25] = "y";
$alphachars[26] = "z";
$alphachars[27] = "0";
$alphachars[28] = "1";
$alphachars[29] = "2";
$alphachars[30] = "3";
$alphachars[31] = "4";
$alphachars[32] = "5";
$alphachars[33] = "6";
$alphachars[34] = "7";
$alphachars[35] = "8";
for ($i=0;$i<strlen($string);$i++) {
for ($j=0;$j<36;$j++) {
if(strtolower(substr($string, $i, 1)) == $alphachars[$j]) {
$charok == 1;
}
}
if (!$charok) {
retu\r\n false;
}
$charok = NULL;
}
retu\r\n true;
}
?>
No Comments to show


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.