How does PHP get the ASCII code in Chinese?

Source: Internet
Author: User
Tags unpack
Use ASC directly in ASP ("Medium") to get 10544

Using Ord (' Middle ') in PHP is 228.

How can I get ASCII code in Chinese like ASP?

Please help the Master


Reply to discussion (solution)

ASC () ANSI character code

ASC () ANSI character code
Dizzy

Only valid for GBK encoding!

echo ASC (' Medium '), function asc ($s) {  if (ord ($s) <) return Ord ($s);  Return current (Unpack (' N ', "\xff\xff$s"));}
-10544

Only valid for GBK encoding!

echo ASC (' Medium '), function asc ($s) {  if (ord ($s) <) return Ord ($s);  Return current (Unpack (' N ', "\xff\xff$s"));}
-10544

Thank you very much, UTF-8. Use Iconv to turn it.

For the utf-8 to turn into GBK can be consistent with the ASP

For the utf-8 to turn into GBK can be consistent with the ASP


Thank you very much, but the principle still doesn't know it's too complicated. I need to study it too much.

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