function chkType($String, $type)
{
	switch ($type)
	{
		case "number":  //숫자만
			$filter = "'^[1-9][0-9]*$'";
		break;
		case "digit":   //숫자만
			$filter = "'^[[:digit:]]*$'";
		break;
		case "alpha":  //영문만
			$filter = "'^[[:alpha:]]*$'";
		break;
		case "alnum":  //영문,숫자만
			$filter = "'^[[:alnum:]]*$'";
		break;
		case "falnum":  //영문,숫자만(첫자는 영문)
			$filter = "'^[a-zA-Z][0-9a-zA-Z]*$'";
		break;
		case "lalpha":  //소-영문만
			$filter = "'^[a-z]*$'";
		break;
		case "ualpha":  //대-영문만
			$filter = "'^[A-Z]*$'";
		break;
		case "lalnum":  //소-영문,숫자만
			$filter = "'^[0-9a-z]*$'";
		break;
		case "ualnum":  //대-영문,숫자만
			$filter = "'^[0-9a-z]*$'";
		break;
		case "email":  //이메일
			$filter = "'^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*$'";
		break;
		case "koralnum": //한글숫자영문
			$filter = "'^[\xa1-\xfe0-9a-zA-Z]*$'";
		break;
		case "kor":   //한글
			$filter = "'^[\xa1-\xfe]*$'";
		break;
	}
	if(preg_match($filter, $String, $matches)) return true;
	else return false;
}

+ Recent posts