In this lecture, we'll be using the echo statement to output variable values.
Variables are used to store data, like string of text or numbers. To declare a variable, a dollar sign must be used followed by the name of the variable. Here are few tips you should put in mind whenever you want to use variables:
In PHP, a variable starts with $ followed by the variable name (name can be anything but not a PHP reserved word)
A variable should be at the left hand side and the value at the right hand side
The equal sign (=) is the assignment operator used to assign value to a variable.
A variable name must start with a letter or the underscore character _
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _)
Variable names are case-sensitive ($name and $NAME are two different variables)
In PHP variable can be declared as: $var_name = value;
Тэги:
##phpvariables_#variablevalues