» Variable Varaibles by falsepride |
|
(Login to remove green text ads)
Okay heres something that can come inhandy of be totally useless to you depending on how you do things. I, myslef have used this before. Variable variables are a variable where the variables name is a variable ex.
PHP Code:
<?php
$name = "test";
$test = "hello world";
echo $$name;
?>
The above would print out hello world.
It prints out hello world instead of test because your using a variable variable. Lets look at this an easier way. The last line,
can look confusing but if we add {} it looks a little cleaner.
If people still dont understand variable variables if you were to break down the last line step by step, it would be:
PHP Code:
1. echo ${$name};
2. echo ${test};
3. echo $test;
|
|