Use Chinese as the variable name in php

Source: Internet
Author: User
Welcome to the Linux community forum and interact with 2 million technical staff. use Chinese as the variable name in php: So are other languages in php. Generally, we define variables as letters and numbers, it may consist of underscores (_), but Chinese Characters in PHP can also be used as a part of the variable. The following is a brief introduction: a valid variable name in PHP can be opened by letters or underscores (_).

Welcome to the Linux community forum, and interact with 2 million technical staff> use Chinese as the variable name in php: This is also true in other languages in php. Generally, we define variables as letters and numbers, it may consist of underscores (_), but Chinese Characters in PHP can also be used as a part of the variable. The following is a brief introduction: a valid variable name in PHP can be opened by letters or underscores (_).

Welcome to the Linux community forum and interact with 2 million technicians>

Use Chinese as the variable name in php:

The same is true for other php languages. Generally, variables are defined as letters, numbers, and underscores. However, Chinese characters in PHP can also be used as part of variables. The following is a brief introduction:

A valid variable name in PHP starts with a letter or underline, followed by any number of letters, numbers, or underscores. according to the regular expression, it will be expressed as: '[a-zA-Z _ \ x7f-\ xff] [a-zA-Z0-9 _ \ x7f-\ xff] *'.

Note: The letters mentioned here are a-z, A-Z, and ASCII characters from 127 to 255 (0x7f-0xff ).

$ Var = 'bob ';

$ Var = 'job ';

Echo "$ var, $ Var"; // output "Bob, Joe"

$4 site = 'not yun'; // The name of an invalid change. It must start with a number.

$ _ 4 site = 'not yun'; // valid variable name; starting with an underscore

$ Php self-learning network is = 'mansika2 '; // valid variable name; Chinese

?>

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.