PHP get Chinese phonetic Code _php tutorial

Source: Internet
Author: User

PHP to get Chinese phonetic code


Get phonetic code for Chinese


  {$_q = Ord (substr ($chinese, + + $i, 1)), $_p = $_p * + $_q-65536;} $result. = ($ucfirst Ucfirst (Self::_pinyin ($_p, $data)): Self::_pinyin ($_p, $data));} Return Preg_replace ("/[^a-z0-9]*/i", "', $result);} private static function _pinyin ($num, $data) {if ($num > 0 && $num <) return Chr ($num); ElseIf ($num < -20319 | | $num > -10247) return '; Else{foreach ($data as $k = + $v) {if ($v <= $num) break;} return $k;}} private static function _u2_utf8_gb ($c) {$string = "," if ($c < 0x80) $string. = $c; ElseIf ($c < 0x800) {$string. = Chr (0xC0 | $c >> 6); $string. = Chr (0x80 | $c & 0x3F);} ElseIf ($c < 0x10000) {$string. = Chr (0xE0 | $c >>); $string. = Chr (0x80 | $c >> 6 & 0x3F); $string. = Chr (0x80 | $c & 0x3F);} ElseIf ($c < 0x200000) {$string. = Chr (0xF0 | $c >>) $string. = Chr (0x80 | $c >> & 0x3F); $string. = Chr (0x80 | $c >> 6 & 0x3F) $string. = Chr (0x80 | $c & 0x3F);} Return Iconv (' UTF-8 ', ' GB2312 ', $string);}?  >


http://www.bkjia.com/PHPjc/847856.html www.bkjia.com true http://www.bkjia.com/PHPjc/847856.html techarticle php get Chinese pinyin code to get Chinese phonetic code 160) {$_q = Ord (substr ($chinese, + + $i, 1)) $_p = $_p * + $_q-65536;} $result. = ($ucfirst Ucfirst (Self::_pinyin ($_p ...

  • 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.