캐릭터셋이 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)
반응형
'인터넷정보' 카테고리의 다른 글
MS MVP의 IE7 완벽 단축키 63개 (0) | 2008.02.03 |
---|---|
MS MVP의 IE7 완벽 단축키 63개 (0) | 2008.02.03 |
알아두면 편리한 자판 단축키들(웹서핑용) (0) | 2008.01.05 |
알아두면 편리한 자판 단축키들(웹서핑용) (0) | 2008.01.05 |
문자열 1바이트씩 배열에 담기 (0) | 2007.12.27 |
백단표,구구단표, 십구단표, 19단 외 각종 유용한 정보 모음... (0) | 2007.12.22 |
[함수] 어설픈 GD 사용 EZBtn ??? (0) | 2007.12.22 |
[함수] 어설픈 GD 사용 EZBtn ??? (0) | 2007.12.22 |
PHP Shorthand If / Else Examples (0) | 2007.12.22 |
PHP Shorthand If / Else Examples (0) | 2007.12.22 |