PHP Variables
Variable is declared using a $ sign followed by the variable name. A variable stores a value of any type. e.g., a string, a number, an array, or an object.
Syntax
$variablename=value;
When defining a variable, you need to follow these rules:
- The variable name must start with the dollar sign ($).
- The first character after the dollar sign ($) must be a letter (a-z) or the underscore ( _ ).
- The remaining characters can be underscores, letters, or numbers.
Declaring string, integer, and float
Sum of two variables
case sensitive
In PHP, variable names are case sensitive. So variable name "color" is different from Color, COLOR, COLor etc.