A variable starts with the
$
sign.
For instance:
$firstname = "Levani";
$lastname = "Makhareishvili";
$age = 19;
• Assignment Operator (=) is used to assign the value to a variable.
• the variable $firstname will hold the value "Levani",
• the variable $lastname will hold the value "Makhareishvili" and so on.
To output the variable on the screen, we write the name of the variable:
echo $age;
When we want to output the value of the variable together with the text, we write the name of the variable
in double quotes or after the text we write a comma or a dot and then the name of the variable:
echo "My name is $firstname $lastname, I am $age years old";
echo "My name is ",$firstname," ",$lastname,", I am ".$age. " years old.";
! PHP statements end with semicolons (;).