Dynamic Variable in PHP


In this article I explain variables of a variable or dynamic variables in PHP. A variable of a variable takes a value of a variable and threads which is the name of a variable. This is new feature of using variables and by using double dollar signs. This technique is called a dynamic variable in PHP. Those variables you can use a dynamically generated variable of variable as well as OOP Concept.  

Variable of variable in php.jpg



$b = 'hello';

$$b = 'Sharad Gupta';

echo $b.${$b};



variable1 in php.jpg



class name

var $is="This is inside the name";

var $m="my variable";



$o=new name;

$m='my variable';

echo $o->is."<br/>";


echo $o->$bas[1];





variable in php.jpg