note 43331 deleted from function.strspn by nlopess
| From: | nlopess@php.net | Date: | Tue, 11 Oct 2005 17:28:47 +0000 |
| Subject: | note 43331 deleted from function.strspn by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96844@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Yes, it's a possibility. However, i think, it's better like that :
<?php
function valid($str, $validlength=10, $validmask="abcdefghijklmnopqrstuvwxyz0123456789_-")
{
$str=strtolower($str);
if (strspn($str, $validmask) == strlen($str) && strlen($str)<=$validlength)
return true;
return false;
}
?>
Sorry for my english, i'm french.