This function is significantly faster for checking illegal characters than the equivalent preg_match() method.
raz
chek a word for ligal characters,
ex:
<?php
$word="abcdef";
$valid_chars="abcdefghijklmnopqrstuvwxyz";
if(strspn($word,$valid_chars) != strlen($word)){
// do some thing here
$error="this word $word contain an illegal chars!";
}
?>