PHP converts full-width characters in a string to half-width characters
PHP converts full-width characters in a string to half-width characters, excerpted from Ecshop.
/** * Converts a string containing full-width numeric characters, letters, spaces, or '%+-() ' characters to corresponding half-width characters * @access public * @param string $str to be converted String * @return str ing $str processed string */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 ' = ' + ', '-' = ', ' m ', ' n ' + ' n ', ' o ' = ' o ', ' p ' = = ' P ', ' q ' + = ' q ', ' r ' = ' + ' r ', ' s ' = ' = ', ' + ' and ' t ', ' u ' + = ' u ', ' v ' = = ' V ', ' w ' = = ' W ', ' x ' + ' x ', ' y ' = = ' y ', ' 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 ' and ' t ', ' u ' = ' u ', ' V ' = ' V ' , ' w ' = ' W ', ' x ' = ' x ', ' y ' = ' y ', ' z ' + ' z ', ' (' + = ' (', ') ' = ') ' , ' (' = ' + ' [', ') ' + '] ', ' ' ' ' + ' [', ' ' ' ' ' + '] ', ' ' ' = ' ' [', ' ' ' + '] ', ' ' ' ' = ' [', ' ' = ' = ', ' ' = ', ' ' = ', ' ' = ', ' ' = ', ' ' = ', ' ' = ', ' ' = ', ' ' = ', ' ' = ', ' = ', ' ' + ' ' = ' > ', '% ' = '% ', ' + ' + ' + ', '-' = '-', '-' = '-', ' ~ ' = '-', ': ' = ': ', '. ' = = ', ', ', ' = = ', ', ', ' = ', ', ', ' = ', ', '; ' = ', ', '? ' = = '? ', '! ' = = '! ', ' ... ' + '-', ' ‖ ' and ' | ', ' ' ' ' + ' ', ' ' ' ' + ' ', ' ' ' ' ' ' = ' and ', "' = = '); Return Strtr ($str, $arr);}
Articles you may be interested in
- PHP converts consecutive spaces in a string to a space
- How PHP converts BR newline characters in HTML to line breaks in text input
- JS How to convert the returned string to JSON-formatted data
- MySQL query with single quotation mark string and insert with single quote string need to pay attention to the problem
- PHP to determine whether the string is in English, pure Chinese, the method of combination of English
- PHP functions convert 16 color codes to RGB color values
- PHP gets the character length of the UTF8 string
- JS array to string, JS string to array method summary
http://www.bkjia.com/PHPjc/999259.html www.bkjia.com true http://www.bkjia.com/PHPjc/999259.html techarticle PHP converts full-width characters in a string to half-width characters php converts full-width characters in a string to half-width characters, and is excerpted from Ecshop. /** * A string containing full-width numeric characters, letters ...