note 41721 deleted from function.strpos by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 21 Apr 2004 01:17:19 +0000 |
| Subject: | note 41721 deleted from function.strpos by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68399@lists.php.net to get a copy of this message | ||
Note Submitter: simen@NOSPAM.mac.com
----
Easy function for checking if a string has only a-z, A-Z, 0-9 and - or _ in it.
<?php
function az09 ($in) {
$az09 = "abcdefghijklmnopqrstuvwxyz".
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
"0123456789"."-_";
$lenght=strlen($in);
for ($s=0; $s < $lenght; $s++) {
$charPos=strpos($az09, $in{$s});
if ($charPos === false) {
echo "Error";
}
}
}
?>