variable variable...  right up there with array array

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

example;
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

        for($i=1;$i<100;$i++){
                $user="user".$i;
                echo $$user;
        }

Dave

>-----Original Message-----
>From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, July 16, 2002 9:54 AM
>To: [EMAIL PROTECTED]
>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?
>
>--clip--
>                        $var = "v".$counter."_high_indiv";
>                        $val3 = $$var;
>--clip
>
>Thanks,
> FletchSOD
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to