Ask an ASCII question

Source: Internet
Author: User
For an ASCII question, see the regular expression matching the variable name in the PHP manual:
 $pattern = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/';

The naming rules for variable names are as follows:
It must start with a letter, followed by any character in a number, letter, or underline.

However, in the top regular, \ x7f-\ xff cannot be found in the ASCII code table. What exactly does the 129 codes correspond?









Reply to discussion (solution)

The letter is a-z, A-Z, and ASCII characters from 127 to 255 (0x7f-0xff.

The internal code value ranges from 0 to 80 ~ The ASCII code is extended between 0 and FF. because it is occupied by Chinese characters, it is usually invisible.
But you can see a part of it.

foreach(get_html_translation_table(HTML_ENTITIES) as $k=>$v) {  echo ord($k) . ' => ' . $v . '
';}

The internal code value ranges from 0 to 80 ~ The ASCII code is extended between 0 and FF. because it is occupied by Chinese characters, it is usually invisible.
But you can see a part of it.

foreach(get_html_translation_table(HTML_ENTITIES) as $k=>$v) {  echo ord($k) . ' => ' . $v . '
';}


Well, after figuring out what these codes are, there is another problem. isn't the naming of variables only allow numbers, letters, and underscores? I just tried to declare a variable.
$a⊥ = '123';echo $a⊥.'
';

There is output. Is this a bit self-explanatory about the limitations?

The letter is a-z, A-Z, and ASCII characters from 127 to 255 (0x7f-0xff.



Oh, now I understand. I don't quite understand it at the beginning.

Thank you!

$ Variable = 'abc ';
Echo $ variable;

Are Chinese characters also letters?

$ Variable = 'abc ';
Echo $ variable;

Are Chinese characters also letters?


Understand! The knowledge is not comprehensive enough. thank you for your attention!

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.