A variable is a name for a container that holds one or more values. The name of the variable is constant throughout the program, but the value or values contained in that variable typically change over and over again throughout the execution of the program.
A scalar variable holds a single scalar value (representing a number, a string, or a reference). Scalar variable names begin with a
dollar sign followed by a letter, and then possibly more letters, or digits, or underscores.[
Upper- and lowercase letters are distinct: the variable
$a_very_long_variable_that_ends_in_1is different from:
You should generally select variable names that mean something regarding the value of the variable. For example,