note 41721 added to function.strpos
| From: | simen at NOSPAM dot mac dot com | Date: | Wed, 21 Apr 2004 00:03:54 +0000 |
| Subject: | note 41721 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68395@lists.php.net to get a copy of this message | ||
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";
}
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41721
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41721&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41721&report=yes
Search -- http://master.php.net/manage/user-notes.php