PHP Variable@ Shwetank education.com
A variable is used to store information.
Variables are used for storing values, like text strings, numbers or arrays.
All variables in PHP start with a $ sign symbol.
The correct way of declaring a variable in PHP:
$var_name = value;
New PHP programmers often forget the $ sign at the beginning of the variable. In that case it will not work.
sign must be start
is a variable name
- is a variable value
Let's try creating a variable containing a string, and a variable containing a number:
Example with Output