note 20661 deleted from ref.strings by philip

From: Date: Sat, 21 Dec 2002 01:42:06 +0000
Subject: note 20661 deleted from ref.strings by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41167@lists.php.net to get a copy of this message
Much faster and much better way to check does string consists from alphanumeric chars 'only' ... By the way, author of previous isalphanumstr() forgot to add whitespace to his array. It's not an alphanumeric char, but who would need this function without it ? :) function isalphanumstr($string) { $res=true; for($i = 0; $i < strlen($string); $i++) if((ord($string[$i])<48 && ord($string[$i])!=32) || (ord($string[$i])>57 && ord($string[$i])<65) || (ord($string[$i])>90 && ord($string[$i])<97) || ord($string[$i])>122) {$res=false; break;} return $res; } echo isalphanumstr(" 1234567890qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM"); //... returns "1" //;)

« previous php.notes (#41167) next »