PHP full-width half-width conversion function. This article mainly introduces the PHP full-width half-width conversion function, and lists all the available full-width columns for replacement, if you need it, refer to the article I tried to find online. This article mainly introduces the PHP full-width half-width conversion function, and lists all the available full-width conversion functions one by one, for more information, see
I tried to replace ASCII characters on the internet and found many inexplicable problems. Finally, replace it with the following character replacement method, and list all the available full corners one by one. The code is as follows: /*** convert fullwidth characters to halfwidth characters ** @ param string $ str * @ return string */public function Sbc2Dbc ($ 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 );}
I tried to find it online before renewing...