<?php
Header ("content-type:text/html; Charset=utf-8 ");
First argument: Passing in the string to be converted
Second parameter: Take 0, half angle turn full angle, take 1, full angle to half angle
function Sbc_dbc ($STR, $args 2) {
$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
} else if ($args 2 = = 1) {
Return Str_replace ($DBC, $SBC, $STR); Full angle to half angle
} else {
return false;
}
}
$str 1 = "fxc516";
$str 2 = "fxc516";
echo "Half angle turn full angle: <br/>";
echo $str 1. ' and '. SBC_DBC ($str 1, 0);
echo "<br/><br/> Full angle turning half angle: <br/>";
Echo $str 2. ' and '. Sbc_dbc ($str 2, 1);
?>
PHP Full-width half-width conversion