Variables in PHP
Variables are used to store values such as numbers, text strings or arrays.
Once a variable is set, we can use it repeatedly in the script.
All variables in PHP start with the $ symbol, and variable names are case-sensitive.
The correct way to set variables in PHP is:
$var_name = value; Beginners to PHP often forget the $ sign in front of the variable. If you do that, the variable will be invalid.
Although initializing variables is not required in PHP, it is a good practice. Uninitialized variables have a default value of their type - FALSE, zero, the empty string, or the empty array.
Copy the code The code is as follows:
$var = 'PHP';
$Var = 'Tutorial Network';
echo "$var, $Var"; // Output "PHP , Tutorial Network"
$4site = 'not yet'; // Illegal name change; starts with a number
$_4site = 'not yet'; // Legal variable name; starts with an underscore
$i site is = 'mansikka'; // Legal variable name; can use Chinese
?>
The above introduces the PHP tutorial PHP tutorial variable definition, including the content of the PHP tutorial. I hope it will be helpful to friends who are interested in the PHP tutorial.