May 2016
Intermediate to advanced
155 pages
2h 15m
English
© Mikael Olsson 2016
Mikael Olsson, PHP 7 Quick Scripting Reference, 10.1007/978-1-4842-1922-5_2
Mikael Olsson1
(1)Hammarland, Finland
Variables are used for storing data, such as numbers or strings, so that they can be used multiple times in a script.
A variable starts with a dollar sign ($) followed by an identifier, which is the name of the variable. A common naming convention for variables is to have each word initially capitalized, except for the first one.
$myVar;A value can be assigned to a variable by using the equals sign, or assignment operator (=). The variable then becomes defined or initialized.
$myVar = 10;Once a variable has been defined, it can be used by referencing the variable’s name. For example, the ...
Read now
Unlock full access