codice:
$stringa="ciao";
if(preg_match("/^[a-z0-9]+$/i",$stringa))
	echo "OK";
else
	echo "NO";