Variable
Every variable starts with "$" eg.
Assignment of a string to a variable.
$var = "God is a power";
$var = "God is a power";
echo $var; // To print a variable value
?>
If you will see the code given below, now I am using "" around $var
But output of the following code will be same as above.
$var = "God is a power";
echo "$var"; // To print a variable value
?>
OUTPUT
But if I will use ” around $var
then output of the following code will differ.
$var = "God is a power";
echo '$var';
?>
OUTPUT
If a variable would be wrapped in the single quotes and it would be echoed, then the result would be the name of that variable.
NOTE :- Every line would be terminated by ";" sign.
[…] Global variables– Now there is no need to use global keyword for variable variables.The previous behaviour is emulated by using curly brace syntax. […]