R
Rajesh
Lets Consider a simple program like this
$i = 'a';
$a = "why is it so boring?";
print "$$i";
Now, the output will be the string "why is it so boring?" because $$i
will now get referenced to $a and hence the string.
Now, instead $i has the value $a . Something like,
$i = '$a';
$a = "why is it so boring?";
print "$i";
In this case, the output will be "$a" and not the string that is
expected.
But, I want the output to be the string. How would I get the value of a
variable if another variable has this variable?
$i = 'a';
$a = "why is it so boring?";
print "$$i";
Now, the output will be the string "why is it so boring?" because $$i
will now get referenced to $a and hence the string.
Now, instead $i has the value $a . Something like,
$i = '$a';
$a = "why is it so boring?";
print "$i";
In this case, the output will be "$a" and not the string that is
expected.
But, I want the output to be the string. How would I get the value of a
variable if another variable has this variable?