how do I use variable variables.
Posted: Thu Jan 02, 2003 9:35 pm
What I am dying to know is some of the ways that I can use variable variables?
I already can grasp the idea on how they work, but I can not understand there usefulness and how to use them.
a variable variables definition is: a variable variable takes the value of a variable and treats that as the name of a variable. Good I understand all that not a problem for me.
I can see how this prints "This is test" to the browser thats not a problem for me.
The problem for comes when I try to think of a reason to use a variable
variable, so if anyone can show me an easy to follow example of a variable variable in use, that will I hope help clarify things in my mind.
Thank You.
I already can grasp the idea on how they work, but I can not understand there usefulness and how to use them.
a variable variables definition is: a variable variable takes the value of a variable and treats that as the name of a variable. Good I understand all that not a problem for me.
Code: Select all
<?php
$test="This is test";
$b="test";
$a=${$b};
echo $a;
?>
output "This is test"The problem for comes when I try to think of a reason to use a variable
variable, so if anyone can show me an easy to follow example of a variable variable in use, that will I hope help clarify things in my mind.
Thank You.