function recognizeKorean($txt)
{
	// for ANSI string
	if (preg_match("/[\xA1-\xFE][\xA1-\xFE]/", $txt)) return "ko";
		
	// for UTF8 string
	if (preg_match("/[\xE0-\xFF][\x80-\xFF][\x80-\xFF]/", $txt)) return "ko";

	// otherwise return "en"
	return "en";
}


  • No labels