PHP Full-width half-width conversion function _php Tutorial

Source: Internet
Author: User
This article mainly introduces the PHP full-width half-width conversion function, the current can find all the full-width is listed to replace it, the need for friends can refer to the next

I've tried to find a lot of puzzling problems by replacing them with ASCII and other characters. Finally, the following character substitution method, the current can find all the full-width of a list of the code as follows:/** * Full-width character converted to half-width * * @param string $STR * @return String */Public function Sb C2DBC ($str) {$arr = array (' 0 ' = ' 0 ', ' 1 ' = ' 1 ', ' 2 ' = ' 2 ', ' 3 ' = ' 3 ', ' 4 ' = ' 4 ', ' 5 ' = ' 5 ', ' 6 ' = ' 6 ' and ' 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 ' + = ', ' 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 ' and ' s ', ' t ' and ' t ', ' u ' = ' ' u ', ' V ' + ' V ', ' w ' = = ' W ', ' x ' = ' x ', ' y ' = > ' z ', ' (' = ' (', '' = ' + ') ', ' (' = ' = ' (') ', ' ' + ') ', ' ' ' ' ' ' ' [', ' ' ' ' ' + '] ', ' ' ' + ' ' [', ' ' ' + '] ', ' ' ' ' + ' ' ', ' ' ' = ' \ ', ' ' + ' ', ' ' + ' ', ' {' = ', ' '} ', ' + ', ' ' ' = ' < ', ' ' = ' > ', '% ' = '% ', ' + ' + ' + ', '-' = ' + ' -', '-' + '-', ' ~ ' = ' ~ ', ': ' = ': ', '. ' = = ', ', ', ' = = ', ', ', ' = = ', ', ', ' = = ', ', '; ' ' = = '? ', '! ' = = '! ' = '-'-', ' ‖ ' and ' | ', ' ' ' ' ' ' ' ' ' ' ', ' ' ' + ' ', ' ' ' + ' ', ' | ' + ' | ', ' ' = ', ' ', ' ' ' ' gt; ' * ', '  ̄ ' = ' ~ ', '. ' = = ', ' * ' = ' * ', ' + ' and ' = ' & ', ' ' = ' < ', ' ' and ' = ' > ', ' $ ' + ' $ ', ' @ ' + ' @ ', ' ^ ' + ' ^ ', ' _ ' = > ' _ ', ' ' ' + ', ' ', ' ¥ ' = ' $ ', ' = ' = ' = ' = ', ' \ ' = ', ' ' \ ' = '; Return Strtr ($str, $arr); }

http://www.bkjia.com/PHPjc/730224.html www.bkjia.com true http://www.bkjia.com/PHPjc/730224.html techarticle This article mainly introduces the PHP full-width half-width conversion function, the current can find all the full-width is listed to replace it, the need for friends can refer to the online search before the pass ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.