Home >Backend Development >PHP Tutorial >Variables in PHP, PHP variables_PHP tutorial
A program is composed of two parts: code and data. Data is stored in variables. The essence of variables is a storage space in memory. The space corresponding to the variable has a name, called the variable name, which is used to read and write data.
The '$' symbol must be used before the PHP variable name, which can also be understood as '$' is the grammatical structure for defining variables
Example:
echo variable name;
Example:
Variable name=value;
unset(variable name);
Example:
Naming convention for variables:
1. Must start with '$'
2. Can only contain letters, numbers, and underscores
3. The '$' symbol cannot start with a number