캐릭터셋이 euc-kr 이라 전제하고
$temp_var = "a-_fa(#)^$*F&3i4-0한2글abc3국민 az?/a*&韓お手?ご迷惑をお掛けしました、";
$cnt = strlen($temp_var);
$array = array();
for($i = 0; $i < $cnt; $i++)
{
if(ord($temp_var[$i]) < 128)
{
$array[] = $temp_var[$i];
}
else{
$array[] = substr($temp_var, $i, 2);
$i++;
}
}
array
0 => string 'a' (length=1)
1 => string '-' (length=1)
2 => string '_' (length=1)
3 => string 'f' (length=1)
4 => string 'a' (length=1)
5 => string '(' (length=1)
6 => string '#' (length=1)
7 => string ')' (length=1)
8 => string '^' (length=1)
9 => string '$' (length=1)
10 => string '*' (length=1)
11 => string 'F' (length=1)
12 => string '&' (length=1)
13 => string '3' (length=1)
14 => string 'i' (length=1)
15 => string '4' (length=1)
16 => string '-' (length=1)
17 => string '0' (length=1)
18 => string '한' (length=2)
19 => string '2' (length=1)
20 => string '글' (length=2)
21 => string 'a' (length=1)
22 => string 'b' (length=1)
23 => string 'c' (length=1)
24 => string '3' (length=1)
25 => string '국' (length=2)
26 => string '민' (length=2)
27 => string ' ' (length=1)
28 => string 'a' (length=1)
29 => string 'z' (length=1)
30 => string '?' (length=1)
31 => string '/' (length=1)
32 => string 'a' (length=1)
33 => string '*' (length=1)
34 => string '&' (length=1)
35 => string '韓' (length=2)
36 => string 'お' (length=2)
37 => string '手' (length=2)
38 => string '?' (length=1)
39 => string 'ご' (length=2)
40 => string '迷' (length=2)
41 => string '惑' (length=2)
42 => string 'を' (length=2)
43 => string 'お' (length=2)
44 => string '掛' (length=2)
45 => string 'け' (length=2)
46 => string 'し' (length=2)
47 => string 'ま' (length=2)
48 => string 'し' (length=2)
49 => string 'た' (length=2)
50 => string '、' (length=2)
$temp_var = "a-_fa(#)^$*F&3i4-0한2글abc3국민 az?/a*&韓お手?ご迷惑をお掛けしました、";
$cnt = strlen($temp_var);
$array = array();
for($i = 0; $i < $cnt; $i++)
{
if(ord($temp_var[$i]) < 128)
{
$array[] = $temp_var[$i];
}
else{
$array[] = substr($temp_var, $i, 2);
$i++;
}
}
array
0 => string 'a' (length=1)
1 => string '-' (length=1)
2 => string '_' (length=1)
3 => string 'f' (length=1)
4 => string 'a' (length=1)
5 => string '(' (length=1)
6 => string '#' (length=1)
7 => string ')' (length=1)
8 => string '^' (length=1)
9 => string '$' (length=1)
10 => string '*' (length=1)
11 => string 'F' (length=1)
12 => string '&' (length=1)
13 => string '3' (length=1)
14 => string 'i' (length=1)
15 => string '4' (length=1)
16 => string '-' (length=1)
17 => string '0' (length=1)
18 => string '한' (length=2)
19 => string '2' (length=1)
20 => string '글' (length=2)
21 => string 'a' (length=1)
22 => string 'b' (length=1)
23 => string 'c' (length=1)
24 => string '3' (length=1)
25 => string '국' (length=2)
26 => string '민' (length=2)
27 => string ' ' (length=1)
28 => string 'a' (length=1)
29 => string 'z' (length=1)
30 => string '?' (length=1)
31 => string '/' (length=1)
32 => string 'a' (length=1)
33 => string '*' (length=1)
34 => string '&' (length=1)
35 => string '韓' (length=2)
36 => string 'お' (length=2)
37 => string '手' (length=2)
38 => string '?' (length=1)
39 => string 'ご' (length=2)
40 => string '迷' (length=2)
41 => string '惑' (length=2)
42 => string 'を' (length=2)
43 => string 'お' (length=2)
44 => string '掛' (length=2)
45 => string 'け' (length=2)
46 => string 'し' (length=2)
47 => string 'ま' (length=2)
48 => string 'し' (length=2)
49 => string 'た' (length=2)
50 => string '、' (length=2)
'인터넷관련' 카테고리의 다른 글
브라우저 내장객체 - select, option (0) | 2008.01.18 |
---|---|
프레임 페이지 새로고침[F5] 후에도 현재 페이지 계속 보이기 (0) | 2008.01.18 |
알아두면 편리한 자판 단축키들(웹서핑용) (0) | 2008.01.05 |
플래시플레이어(Adobe Flash Player 7,8,9) 재설치 (0) | 2008.01.04 |
[함수] 어설픈 GD 사용 EZBtn ??? (0) | 2007.12.22 |
PHP Shorthand If / Else Examples (0) | 2007.12.22 |
cron을 사용하지않고 화일 캐쉬 (0) | 2007.12.22 |
[서버운영] Apache mod_gzip 압축 (0) | 2007.12.22 |