A variable in PHP is just like a container to store the data.
Every variable has a name and a value(data)
$num; $_total; $count = 3; $string_1; $str_find; $date_time; $dateTime;
num; // error, variable should start with $ $3point; // error, Variable name must start with a letter or underscore "_". $date-time; // error,Only be comprised of a-z, A-Z, 0-9, or _ $date time; // error, Should not contain whitespace $total = 98; echo $TOTAL; // error,$total and $TOTAL are two different variables
Declare a variable begin with number, will cause a syntax error, for example: $3point;
Parse error: syntax error, unexpected '3' (T_LNUMBER), expecting variable (T_VARIABLE)
The assignment operator (=) used to assign value to a variable.
$count = 1;// assign a value when declared $num; $num = 30; // assign value to a variable declared previously