Question and answer is powered by AnsPress.io
$var = ‘foo’;
$$var = ‘bar’;
echo $foo;
What will be the output?
$name=abc;
$$name=xyz;
The value of $name will be also a variable. when we write $$name.
Example.
echo$name;
Output: abc
echo$abc;
Output: xyz
echo$$name;
Output: xyz
$a = “welcome”;
$welcome = 50;
echo $a /// will print : welcome
echo $$a /// will print : 50
the process is in $$a , will treat welcome as a variable not a value
dynamic variable: if $var = variableOne, $$var will be $(variableOne) indefination we have a dynamic variable: $variableOne.
$$name.it dynamic variable. let support you have country value in name variable.so you can call it like this.echo $country.
Its. Called single ($) doller and another called double ($$) doller in Php … The differenc is. In single doller ($) is a normal varible which stores any valuw like string,int,and float. In otherwords $$ (doube) dolller is unreference variable which store value of single $ inside it.