기술문서창고/php

php - 2byte 문자가 포함되었는지 검사

progh2 2004. 3. 27. 09:26

/**
* 2byte 문자가 포함되었는지 검사
* [x00-x7F] : ASCII/JIS-Roman (1 byte/char)
* x8E[xA0-xDF] : katakana (2 bytes/char)
* x8F[xA1-xFE][xA1-xFE] : JIS (3 bytes/char)
* [xA1-xFE][xA1-xFE] : (2 bytes/char)
* @param string $string : 문자열
* @return boolen
*/

function isHan($string)
{
return preg_match("/[xA1-xFE][xA1-xFE]/", $string, $match);
}


출처: phpschool.com