Checks whether a string consists of alphabetical characters only.
boolean Core_Valid::alpha( string $str [, boolean $utf8 = bool false ] )
参数列表
参数 类型 描述 默认值 $str
string
Input string $utf8
boolean
Trigger UTF-8 compatibility bool false
boolean
public static function alpha($str, $utf8 = false)
{
$str = (string)$str;
if ($utf8 === true)
{
return (bool)preg_match('/^\pL++$/uD', $str);
}
else
{
return ctype_alpha($str);
}
}