Variables are used to store data or any thing to a var.
You can put a data to your var and then using it in your program.
Let's do it
First :-
The variable can be letters or numbers and we can used _ too
but we donot start with numbers so ...
we can use vars like
[PHP] devcoder[/PHP]
[PHP] devCoder[/PHP]
[PHP] DevCoder[/PHP]
[PHP] DevCoder_50[/PHP]
not
[PHP] 50_DevCoder[/PHP]
or
[PHP] Dev Coder[/PHP]
and now we can set the value of the var like
[PHP] devCoder = 50[/PHP]
so now the variable devCoder has the value 50
So, the variable name comes first, then an equals sign. After the equals sign, you tell your variable what it will be doing. Holding the number 50, in our case.
However we are learning PHP the is something missing it's the dollar sign it used to defined the variable like
[PHP] $devCoder = 50[/PHP]
and now the is missing to ..
in PHP at the end - a semi-colon. Lines of code in PHP need a semi-colon at the end:
[PHP] $devCoder = 50;[/PHP]
now it's the true we can use the variable like that
$devCoder = 50;
if we want to see the value just called echo function
[PHP] echo $devCoder;[/PHP]
it will print "50"
now we can use any data to put it in the variable
EX:-
[PHP] $var_first = 5;
$var_second = 10 + 20 + 5;[/PHP]
By ... Dev Coder