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
?>