The following two rules are needed to be followed while naming a PHP variable:
- A variable must start with a dollar symbol, followed by the variable name. For example: $price=100; where price is a variable name.
- Variable names must begin with a letter or underscore.
- A variable name can consist of letters, numbers, or underscores. But you cannot use characters like +, –, %, & etc.
- A PHP variable name cannot contain spaces.
- PHP variables are case-sensitive. So $NAME and $name both are treated as different variables.