function Sbc_dbc ($STR, $args 2) {//half-width and full-width conversion functions, the second parameter if 0, is half-width to full-width; if 1, it is full-width to half-width
$DBC = Array (
0, 1, 2, 3, 4,
5, 6, 7, 8, 9,
A, B, C, D, E,
F, G, H, I, J,
K, L, M, N, O,
P, Q, R, S, T,
U, V, W, X, Y,
Z, a, B, C, D,
E, F, G, H, I,
J, K, L, M, N,
O, p, Q, R, S,
T, u, V, W, X,
Y, Z,-,,:,
. , , , / , % , # ,
! , @ , & , ( , ) ,
",", ",",? ,
[ , ] , { , } , \ ,
|, +, =, _, ^,
¥, ̄, '
);
$SBC = Array (//Half Corner
0, 1, 2, 3, 4,
5, 6, 7, 8, 9,
A, B, C, D, E,
F, G, H, I, J,
K, L, M, N, O,
P, Q, R, S, T,
U, V, W, X, Y,
Z, A, B, C, D,
E, F, G, H, I,
J, K, L, M, N,
O, p, Q, R, S,
T, u, V, W, X,
Y, Z,-,,:,
., ,, /, %, #,
!, @, &, (,),
<, ",",,?,
[, ], {, }, \,
|, , =, _, ^,
$, ~, `
);
if ($args 2==0)
Return Str_replace ($SBC, $DBC, $STR); Half angle to full angle
if ($args 2==1)
Return Str_replace ($DBC, $SBC, $STR); Full angle to half angle
Else
return false;
}
Function call
$str = "ALSKDF";
Echo $str;
echo "
";
Echo sbc_dbc ($str, 0);
Echo Sbc_dbc ($STR, 1);
?>
http://www.bkjia.com/PHPjc/486070.html www.bkjia.com true http://www.bkjia.com/PHPjc/486070.html techarticle ? PHP function Sbc_dbc ($STR, $args 2) {//half-width and full-width conversion functions, the second parameter is half-width to full-width if 0, or 1, full-width to half-width $DBC = Array (0, 1, 2 ...