메뉴 건너뛰기

프로그램언어

2016.12.23 00:41

깨진 한글 체크

조회 수 20223 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

<?php
function is_regular_string($cstring)
{
    $slen = strlen($cstring);

    for($i=0;$i<$slen;$i++) 
    {
      // 1byte 문자 
      if(ord($cstring[$i])<=127) 
      {
          $i++;
      }
      // 2byte 문자             
      else if(ord($cstring[$i])>=hexdec('80')) 
      {
        if (isset($cstring{$i+1}) && $cstring{$i+1} != '' ) 
        {                    
           if(((ord($cstring{$i})>=hexdec('B0') && ord($cstring{$i+1})>=hexdec('A1')) && (ord($cstring{$i})<=hexdec('C8') && ord($cstring{$i+1})<=hexdec('FE'))) || ((ord($cstring{$i})>=hexdec('81') && ord($cstring{$i+1})>=hexdec('41')) && (ord($cstring{$i})<=hexdec('A0') && ord($cstring{$i+1})<=hexdec('FE'))) || ((ord($cstring{$i})>=hexdec('A1') && ord($cstring{$i+1})>=hexdec('41')) && (ord($cstring{$i})<=hexdec('C6') && ord($cstring{$i+1})<=hexdec('A0'))) || ((ord($cstring{$i})>=hexdec('A4') && ord($cstring{$i+1})>=hexdec('A1')) && (ord($cstring{$i})<=hexdec('A4') && ord($cstring{$i+1})<=hexdec('FE'))))
            {
            $i++;
            }
           else 
            {
             return false;
            }                
        }
      }
      else
      {
        return false;
      }
    }
    return true;
}
?>


List of Articles
번호 제목 날짜 조회 수
180 while, for, foreach 속도 비교 2021.03.26 620
179 utf-8 문자열을 주어진 바이트로 자르기 2019.04.29 1356
178 TIME_TO_SEC 시간 포맷 2019.01.16 1381
177 TIFF, GIF 여러장 변환 file 2021.03.26 323
176 text파일에 한줄씩 내용추가하기 2017.03.06 17535
175 Text를 GD 이미지로 뿌리기 2014.02.27 29813
174 substr(), mb_substr(), iconv_substr() 2021.03.26 564
173 stripslashes — 따옴표 처리한 문자열을 풉니다 2016.12.23 20486
172 stripcslashes — addcslashes()로 인용한 문자열을 되돌림 2016.12.23 20442
171 RSSReader Class 제작 및 Reader 만들기 file 2016.08.22 21042
170 RSS json_decone 사용방법 2019.01.16 1430
169 Record Drag/Drop Position 2014.02.27 29201
168 quotemeta 모든 메타 문자앞에 역슬래쉬를 붙인 문자열을 반환 2016.12.23 20461
167 printf() sprintf() 2021.03.26 272
166 preg_match (정규표현식 매치를 수행합니다) 2016.12.23 20843
165 Predefined Variables (미리 정의된 변수들) 2021.03.26 274
164 POST값 통째로 인코딩하기 1 2015.04.06 21175
163 POST, GET으로 배열값 받기(직렬화) file 2017.03.06 23285
162 php한글체크를 위한 정규표현식 2014.04.12 22458
161 PHP폼 사용시 폼 양식에서 값이 사라질때 2019.01.08 1316
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 ... 17 Next
/ 17

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved