Page 1 of 1

content of a variable became a variable :)

Posted: Wed Jan 31, 2007 6:05 pm
by hmsg
Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi 

     I have a variable and i want to transform the value of that variable to a variable.

Code: Select all

Example:

PHP:

<?
     // I have the first variable. that have a value, ex.: 
     $var1="hello";

      // i wish to create a second variable wich name is the value of the $var1
     $$var1 = 3;
     //this is what i want to get with the line before: $hello=3
    //is this possible?
?>
With the best regards

Hugo Gomes


Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Jan 31, 2007 6:06 pm
by RobertGonzalez
Try it and see.

Posted: Wed Jan 31, 2007 8:15 pm
by Ollie Saunders

Posted: Wed Jan 31, 2007 10:11 pm
by superdezign
Wow.. that's like, exactly what he wrote. I personally don't see the use in it, but I guess he does.