Variables are used to store data, like string of text, numbers, etc. Variable values can change over the course of a script. Here're some important things to know about variables: 1. In PHP, a variable does not need to be declared before adding a value to it. PHP automatically converts the variable to the correct data type, depending on its value. 2. After declaring a variable it can be reused throughout the code. The assignment operator (=) used to assign value to a variable. Naming Conventions for PHP Variables These are the following rules for naming a PHP variable: All variables in PHP start with a $ sign, followed by the name of the variable. A variable name must start with a letter or the underscore character _. A variable name cannot start with a number. A variable name in PHP can only contain alpha-numeric characters and underscores (A-z, 0-9, and _). A variable name cannot contain spaces.
by Gigi Butchvelashvili
2 years ago
PHP
Variable
0
Pro tip: use ```triple backticks around text``` to write in code fences