Home>Article>Backend Development> Which symbol does all php variables start with?
All variables in PHP start with the $ symbol. The following is an introduction to the naming convention of PHP variables:
1. Variables start with the $ symbol, and the others followed by the name of the variable
2. The variable name must start with a letter or underscore
3. The variable name cannot start with a number
4. Variable names can only contain alphanumeric characters and underscores (A-z, 0-9 and _)
5. Variable name pairs Case sensitive ($y and $Y are two different variables)
For example:
Note:php variables have a certain range of use after being declared. Most php variables are not declared in functions. Only a separate range from the declaration to the end of the file is used. This separate range can be used in all php modes on a page. , also includes include and require import files. During the variable usage period, you can use unset() to release the specified variable, use isset() to check whether the variable is set, and use isempty() to check whether the variable is empty.
Recommended tutorial:PHP video tutorial
The above is the detailed content of Which symbol does all php variables start with?. For more information, please follow other related articles on the PHP Chinese website!