October 2002
Intermediate to advanced
368 pages
7h 12m
English
One thing that I've found incredibly useful in some of my form-based applications is variable variables. Variable variables allow you to have variable names for variables. This way you can generate variable names on the fly for whatever purposes your script requires.
Example:
$name = "integer"; $$name = 10; //results in $integer = 10;
Note that when you echo these values to the screen, you get different results from those which you may expect. In the above example, if you want to print the value out to the screen, you cannot enclose the variable variable name in quotes as you might normally:
echo "<p>$$name"; // results in "$integer" being printed to the screen echo "<p>" . $$name; //results in "10" being printed to the ...
Read now
Unlock full access