variable variable...  right up there with array array

basically what you are saying is resolve $var, then find out what that variable

assume your $counter is currently at 5

        $var = "v".$counter."_high_indiv";

would mean that $var= "v5_high_indiv"
assuming that v5_high_indiv is dynamically assigned somewhere as a variable

        $$var is the value of $v5_high_indiv

make sense?

variable variables are especially good in loops...  for example, if you have
variables called
        $user1, $user2, $user3....
to print out all the variables would require one line per variable (and alot of
typing).  using variable variables you could print out the value of all users by
looping it

                echo $$user;


>-----Original Message-----
>From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, July 16, 2002 9:54 AM
>Subject: [PHP] Purpose of $$var ?????
>The script was working great before PHP 4.2.x and not after that.  So, I
>looked through the code and came upon this variable, "$$var".  I have no
>idea what the purpose of the double "$" is for a variable.  Anyone know?
>                        $var = "v".$counter."_high_indiv";
>                        $val3 = $$var;
> FletchSOD
>PHP General Mailing List (
>To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to