In PHP program development, it is often necessary to customize some symbols to mark some names, such as variable names, function names, class names, etc. These symbols are called identifiers. The definition of identifiers needs to follow certain rules:
1. Identifiers can only consist of 26 English alphabetic characters in uppercase and lowercase (a~z, A~Z), numbers (0~9), and underscores ( _) and cannot contain spaces.
2.Identifiers can only be composed of characters of any length starting with letters or underscores.
3. When identifiers are used as variable names, they are case-sensitive.
4. If the identifier consists of multiple words, they should be separated by underscores.
5. Predefined keywords in PHP cannot be used
Follow PHP Definition rules for identifiers. The identifiers it, It, it88, and _it are legal, while 8it and i-t are illegal identifiers
PHP variable rules:
Variables start with the $ symbol, followed by the name of the variable, and the other rules are the same as above
Creating PHP variables
PHP has no command to create variables.
Variables will be created the first time they are assigned a value:
Example:
1 2 3 4 5 |
|
Recommended learning: PHP tutorial
The above is the detailed content of What alphabetic characters are allowed in php identifiers?. For more information, please follow other related articles on the PHP Chinese website!