CopyCode The Code is as follows :/**
* Convert a string containing full-width numeric characters, letters, spaces, or '% +-()' to the corresponding half-width characters.
* @ Access public
* @ Param string $ STR string to be converted
* @ Return string $ STR string after processing
*/
Function make_semiangle ($ Str)
{
$ Arr = array ('0' => '0', '1' => '1', '2' => '2 ', '3' => '3', '4' => '4', '5' => '5', '6' => '6 ', '7' => '7', '8' => '8', '9' => '9', 'A' => 'A ', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E ', 'F' => 'F', 'G' => 'G', 'H' => 'h', 'I' => 'I ', 'J' => 'J', 'K' => 'k', 'L' => 'l', 'M' => 'M ', 'N' => 'n', 'O' => 'O', 'p' => 'P', 'q' => 'Q ', 'R' => 'R', 's' =>'s ', 't' => 'T', U' => 'U ', 'V' => 'V', 'w' => 'W ', 'X' => 'x', 'y' => 'y', 'z' => 'Z', 'A' => 'A ', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E ', 'F' => 'F', 'G' => 'G', 'H' => 'h', 'I' => 'I ', 'J' => 'J', 'K' => 'k', 'L' => 'l', 'M' => 'M ', 'N' => 'n', 'O' => 'O', 'p' => 'P', 'q' => 'Q ', 'R' => 'R', 's' =>'s ', 't' => 'T', 'U' => 'U ', 'V' => 'V', 'w' => 'w', 'x' => 'x', 'y' => 'y ', 'Z' => 'Z', '(' => '(', ')' => ')', '[' => '[', ']' => ']', '[' => '[', ']' => ']', '=>' [',' 〗 '=>'] ',' => '[', '"' => ']', ''' => '[', ''' => ']', '{' => '{', '}' => '}', '=>' <',' "'=>', '%' => '% ', '+' => '+', '-' => '-', '-' => '-','~ '=>'-',': '=> ':','. '=> '. ',', '=>', '=> '. ',', '=> '. ','; '=> ',','? '=> '? ','! '=> '! ','... '=>'-', ''' =>' | ',' "'=>'" ', ''' => ''', ''' => ''', '|' => '|', 'Region' => '"','' => '');
Return strtr ($ STR, $ ARR );
}
Copy code The Code is as follows: <? PHP
$ STR = "0123abcdfws \",.? <>{} [] * & ^ % #@!~ () +-| :;";
Echo "$ Str ";
Echo "<br/> ";
$ STR = preg_replace ('/\ xa3 ([\ xA1-\ xfe])/E', 'chr (ord (\ 1)-0x80 )', $ Str );
Echo $ STR;
?>